Free Support Forum -

Setting GroupDocs license in Java

I’m trying to set up license in Java code. Can someone please help me figure out why it is not working?

I have this code which is supposed to set the license.

InputStream is = openStream("license.lic");
License license = new License();

I do not get any exception running the above code. After setting the license, I proceed to create the Viewer and feed it with a source PDF file:

HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat);
Viewer viewer = new Viewer("/home/lab/groupdocs/org/test.pdf");

Still getting no error. I can see that this generates output files in the destination directory, but they all have an copyright note that says “Evaluation Only. Created with Aspose.PDF”.

I also noticed that if I simply remove the code which was supposed to set the license, I still get the same outcome. Does that indicate that the license was not properly validated? Perhaps, am I supposed to pass the License object to ViewerOptions or Viewer ?

More importantly, is there a way to tell whether the issue was with the license itself or with the code not setting the license up correctly?

1 Like


Please share following details and we’ll look into this scenario:

  • API version that you’ve integrated in the project (e.g. 19.11, 20.1)
  • License subscription expiry date (or you can share your license file in a private message)

Your code seems fine.

API version 20.1.

Looking at the license file, it seems that both SubscriptionExpiry and LicenseExpiry dates have been reached. So I guess that must be it.

Thank you for your help, @atirtahir3 !

1 Like


Yes, that’s the issue.