Use Aspose.PDF for Java to generate PDF files - problem while setting license

Hi
When I have
com.aspose
aspose-pdf
17.8

Then when I try to do anything with the PDF library, it says that it’s using the evaluation mode:

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

17.7 works ok, this has happened before.
Pease can you fix as at the moment 17.8 is useless.

@mimecast,
It is because the Aspose license is not applied properly and the evaluation version has limitation to not process more than 4 elements (for any collection). Please refer to this help topic: Apply license to Aspose.Pdf for Java API. However, if this does not help, then kindly share the complete details of the use case, including license file, Visio drawing and code. We will investigate and share our findings with you. Before sharing license file, please mark this thread as private.

Are you sure, because if I change the aspose version for the pdf to 17.7 then it starts working again.
I mean the code I have to use the license works with 17.7.
But it doesn’t work with 17.8.
That to me hint tats the problem is with the version and not with my code?

@mimecast,
Please check your license expiry date which should not be less than the release date of version 17.8. However, if the license is expired, then Aspose.Pdf for .NET API shows an error for renewal of the license. You can open license file with any editing tool like notepad and see subscription expiry tag value. In order to test the license file, please create a small project application with the following code, and then let us know how that goes into your environment.

[Java]

// apply license
com.aspose.pdf.License pdfLic = new com.aspose.pdf.License();
pdfLic.setLicense("C:\\temp\\Aspose.Total.Java.lic");
// initialize a new PDF
Document document = new Document();
// add a new page
document.getPages().add();
// save pdf
document.save("c:\\temp\\output17.8.pdf");

I also have license problem after upgrading to Aspose PDF 17.8. The license can work with 17.4.

<Product>Aspose.Total for Java</Product>
<SubscriptionExpiry>20171117</SubscriptionExpiry>

@psfung,

Your license file is valid for the latest version 17.9 of Aspose.Pdf for Java API and we recommend our clients always use the latest version of Aspose APIs because the latest version incorporates recent features, enhancement and fixes.

Kindly elaborate a bit more about the problem.

I followed your instruction to set license, it worked with Aspose PDF 17.4. Some days ago I replaced aspose.pdf-17.4.jar with aspose-pdf-17.8.jar, everything else is the same as before. Since then the PDF created by Aspose has the words
Evaluation Only. Created with Aspose.Pdf. Copyright 2002-2017 Aspose Pty Ltd.

@psfung,

Kindly send us your license file through a private message. We will investigate and share our findings with you.

@psfung,

We can create a new PDF with your license and Aspose.Pdf for Java 17.9 does not insert a watermark in the output PDF. Please try the following code:

[Java]

com.aspose.pdf.License licDiagram = new com.aspose.pdf.License();
licDiagram.setLicense("C:\\Pdf\\test423\\Aspose.Total.Java.lic");
		
String dataDir = "C:\\Pdf\\test422\\";
// Load source PDF file
Document pdfDocument = new Document();
pdfDocument.getPages().add();
pdfDocument.getPages().get_Item(1).getParagraphs().add(new TextFragment("This is the text"));
pdfDocument.save("C:\\Pdf\\test423\\output.pdf");

This is the output PDF: output.pdf (1.9 KB)

We have downloaded 17.9 Jar of Aspose.Pdf API from the Maven repository, and it takes 5 minutes in our environment.

17.9 works fine. Thank you for your help.

@psfung,

It is nice to hear from you that the problem has been resolved. Please feel free to let us know whenever you require any further assistance.

I guess it was broke in 17.8 and fixed in 17.9.

@mimecast,

Thanks for sharing the feedback. We are glad to hear that your problem is resolved. Please continue using our APIs and in the event of any further query, please feel free to contact.