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

Free Support Forum - aspose.com

Problem with Aspose.Pdf.lic file when deployed on AWS lambda

I have a 30-day evaluation license for Java I got from you recently and I will soon buy it if I solve the next problem:

I have read these instructions:

So I renamed the file from ‘Aspose.Pdf.lic’ to ‘Aspose.Pdf.Java.lic’ and I use this code:

License licensePdf = new License();

I have the renamed file ‘Apsoe.Pdf.Java.lic’ file in the folder ‘C:\Users\Vladimir.VASOVIC.m2\repository\com\aspose\aspose-pdf\18.12’

I also have it in the src/main/resources folder.

And this is my pom.xml file:

	<name>Aspose Java API</name>

It works perfectly locally in Eclipse (when I run unit/integration tests), but when I deploy it on AWS lamba, I get this message:

Expeption message - class com.aspose.pdf.exceptions.PdfException: At most 4 elements (for any collection) can be viewed in evaluation mode.

Pleeeaseeee help!!!
This is so frustrating!!!


Thank you for contacting support.

Would you please elaborate a little more if Aspose.PDF for Java API is working fine in AWS Lambda environment or not, except this Evaluation problem. You may try to execute a single line of code as a test.

Document document = new Document();

It can rule out or highlight any problem about downloading and working of Aspose.PDF for Java API in your project. Secondly, please try to specify full path to the license file. You may also try to verify that the license file is accessible to the API, by reading the file into FileInputStream or ByteArrayInputStream. You may try to Validate the License and share your feedback so that we may investigate further to help you out.

When I use if (com.aspose.pdf.Document.isLicensed())… else… I got this message:

Exception: License is NOT Set! - java.lang.Exception: Cannot find license ‘Aspose.Pdf.Java.lic’.

BTW, I export it to the jar file from Eclipse and in the jar file the file ‘Aspose.Pdf.Java.lic’ is stored in the folder ‘resources’

I have also tried to put ‘licensePdf.setLicense("/resources/Aspose.Pdf.Java.lic");’, but it still doesn’t work. The message is:

Exception: License is NOT Set! - java.lang.Exception: Cannot find license ‘/resources/Aspose.Pdf.Java.lic’.

I was able to solve this issue with this code:


I determined the resourse folder path with this method:

Path url = Paths.get(ClassifyFormFunction.class.getResource("/").toURI());
String path = url.toString()



Thank you for your kind feedback.

We are glad to know that your issue has been resolved. Please keep using our API and in event of any further query, feel free to ask.