Evaluation message is coming up on documents headers and watermarks

Hi,
We are using aspose.Word in our organization for documents generation. We are getting reports of Aspose watermarks and evaluation messages appearing in Word documents, it randomly puts these on some of the documents. We tried to find out a pattern but there isn’t one.

We also tried to assign the license using the following documentation rather than as a file.

https://docs.aspose.com/words/net/licensing/#include-the-license-file-as-an-embedded-resource

This hasn’t helped.
We are using paid subscription of ASPOSE and renew it every year. We are also using the latest ASPOSE version.

Could you please help us here as we need to have it fixed ASAP. Thanks

@usman.khan Please check the following points on your side:

  • Make sure your call to SetLicense gets executed. Step through in the debugger.
  • Make sure your code does not catch an exception thrown by Aspose.Words licensing code. For example, Aspose.Words will throw if it cannot find the license.
  • Make sure the input documents do not already have the evaluation message. Aspose.Words does not delete existing evaluation messages.
  • Make sure SetLicense is executed before you instantiate any Document object.

Thanks a lot @alexey.noskov for the quick response. Really appreciate it. However, we have got some concerns.

We feel like we are already doing all the steps that you have mentioned. It works in 99% of cases so we know the license is being applied correctly but in a few cases the watermarks and evaluation messages appear. We have tried applying the license on the .NET API start-up from a file. Then we tried applying the license from a resource directly before we instantiate any Document object. Both of these approaches work in 99% of cases.

If the Aspose.Words license cannot be applied then we do not generate the documents so we know the license is being applied. We have this small snippet of code to verify the license is applied before generating the document:

/// <summary>
/// Establish whether Word is licensed.
/// </summary>
/// <returns>A boolean to indicate whether the Words license is fully licensed and not in Evaluation mode.</returns>
public static bool IsWordLicensed()
{
    const string testString = "test";
    var doc = new Document();
    var builder = new DocumentBuilder(doc);
    builder.Write(testString);
    using (var ms = new MemoryStream())
    {
        doc.Save(ms, Aspose.Words.SaveFormat.Docx);
        ms.Position = 0;
        doc = new Document(ms);
    }
    return doc.ToString(Aspose.Words.SaveFormat.Text).Trim() == testString;
}

Is there anything else that you can share with us to help resolve this issue. That would be great. Thanks

@usman.khan Thank you for additional information. Aspose.Words check whether license is set on document import and export. So if for some reason license has been removed between loading and saving operation or between document generation operations, this might be the reason of the problem. For example the following code will produce a document with an evaluation watermark:

Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(@"C:\Temp\Aspose.Words.NET.lic");

Document doc = new Document(@"C:\Temp\in.docx");

// This line of code removes the license.
lic.SetLicense("");

doc.Save(@"C:\Temp\out.pdf");

As an option you can try setting the license each time before using Aspose.Words code.

@alexey.noskov Thanks a lot for the quick response once again. Your example makes sense. However, we are always setting the correct license, not the empty string. But I like the idea of adding additional checks of applying it every time on doc gen. Will try it and get back to you for any issues.

@usman.khan Please feel free to ask in case of any further issues. We will be glad to assist. Also, please let us know if you manage to figure our why the problem occurs on your side.

@usman.khan we need to reproduce the “evaluation watermark” issue on our side. Could you please create a test project to demonstrate this issue, build it and send us whole project folder with sources and binaries. I hope it will help us to solve this problem.

@alexey.noskov, As I explained above, that’s what we are struggling with i.e. trying to detect the pattern as it works fine for us most of the time and put evaluation marks on very few documents.

I will update you on this after we implement the code changes. Please don’t close this ticket for now.

Thanks again for your help. Much appreciated.

@usman.khan Sure, please let us know if you manage to find the reason of the problem on your side.

@alexey.noskov We are still getting this issue from time to time. Although not frequently, but we just saw it happened for one of our documents.

Any other ideas on this ? What else we can do to improve it.

@usman.khan Unfortunately, it is difficult to say what the problem is without ability to reproduce it. Could you please create a simple application that will allow us to reproduce it and attach it here along with binaries. We will check the issue and provide you more information.