We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error while setLicense on com.aspose.pdf.License


I am trying to set “Aspose.Total.lic.enc” license to “com.aspose.pdf.License”, but I am getting below exception from “com.aspose.pdf.License:setLicense” API.
Below is the exception stack:
[Fatal Error] :1:1: Premature end of file.
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:262)
at java.xml/javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122)
at com.aspose.pdf.l9f.lI(Unknown Source)
at com.aspose.pdf.License.setLicense(Unknown Source)

I am using “Aspose.Total.lic.enc” of June 2022. And aspose pdf jar version is “aspose-pdf-v22.1”.
Same license file is working fine for slides, cells, words, email, only facing issue with pdf.

Please let me know if I am doing anything wrong.


Would you please try to use the license with 22.8 version of the API. In case you still notice any issues, please share your license file with us in a private message so that we can test the scenario in our environment and address it accordingly. You can send a private message by pressing top left button in the post editor to convert your post into a private message.