Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Sun Apr 25, 2021 4:02 am

Hi,

We use Spire.Doc 4.3.2 mainly for mail-merge and PDF conversion. I am wondering if it is possible to check whether our instance of Spire.Doc has been correctly licensed at runtime.

When we run our headless application, we use `com.spire.license.LicenseProvider.setLicenseKey(<license key>)' to license our application. During our testing, we found that, when deployed in a certain way, the license key was not correctly applied - this was an application error and not a problem with the license. We want to be able to ensure that our license is correctly applied whenever we run the application, because if it is not then we may deliver documents to our clients which have the evaluation license warning.

I cannot find any documentation for this, e.g. something like com.spire.license.LicenseProvider.isLicensed(). Is there a way to do this? I have no concerns about our license being valid, only that we have a safe-guard in place in case we deploy our application incorrectly.

Thanks for your support.

kenantlang
 
Posts: 6
Joined: Wed Feb 03, 2021 9:07 am

Sun Apr 25, 2021 6:29 am

Hello,

Thanks for your inquiry!

Sorry that we do not have a method like isLicensed() to check the license at runtime. You can only judge whether the license is valid by checking whether the generated document contains the evaluation license warning message.

Hope you can understand, and if you have any other questions, just feel free to contact us.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 408
Joined: Wed Nov 04, 2020 2:29 am

Sun Apr 25, 2021 7:12 am

Thanks for your quick response Marcia.

If that is the case, do you have any recommendations for how we can check that the document does not contain the evaluation warning? - given a DOCX file, can we check if the file contains the warning, e.g. by using a string matching function?

kenantlang
 
Posts: 6
Joined: Wed Feb 03, 2021 9:07 am

Sun Apr 25, 2021 7:54 am

Hello,

Thanks for your feedback!

Please refer to the following code to check that whether the document contains the evaluation warning.
Code: Select all
       Document document = new Document();
       document.loadFromFile(filepath);

       TextSelection[] selections = document.findAllString("Evaluation Warning: The document was created with Spire.Doc for JAVA.", false, true);
       if(selections == (null)) {
          System.out.println("no warning");
       }else {
         System.out.println("has warning");
      }

If you have any other questions, just write back to us.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 408
Joined: Wed Nov 04, 2020 2:29 am

Mon Apr 26, 2021 1:57 am

Much appreciated! We will evaluate this and get back to you if there are any problems, but this looks like a good solution - thanks again.

kenantlang
 
Posts: 6
Joined: Wed Feb 03, 2021 9:07 am

Mon Apr 26, 2021 2:44 am

Hello,

You are welcome!

If you encounter any issues related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 408
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.Doc