Aspose license load is slow

Hi,

I am on aspose 22.11. After each new deploy on site aspose license load takes lot of time to load. I am basically trying to do below. What can be the reason for slow performance to get final pdf document. It takes more than 5 minute.

My assessment is tha license file load takes lot of time for first time.
asposeLicenseUtil.setAsposePDFLicense();
com.aspose.pdf.Document documents = new com.aspose.pdf.Document();
for (ReceiveLedger ledger : ledgers) {
Invoice invoice = ledger.getInvoice();
byte[] pdfData = generateInvoicePDFNew(invoice, ledger, userCompany);
ByteArrayInputStream documentStream = new ByteArrayInputStream(pdfData);
com.aspose.pdf.Document document = new com.aspose.pdf.Document(documentStream);
documents.getPages().add(document.getPages());
document.close();
documentStream.close();
}
ByteArrayOutputStream output = new ByteArrayOutputStream();
documents.save(output);
documents.close();
return output.toByteArray();

public void setAsposePDFLicense() throws Exception {
com.aspose.pdf.License license = new com.aspose.pdf.License();
File licenseFile =resourceLoaderService.getResource(“classpath:license/Aspose.Total.Java.lic”).getFile();
license.setLicense(Files.newInputStream(licenseFile.toPath()));
}

@hemant_thote

Your code looks fine. Have you tried with 24.5 version which is the latest one? Can you please share how much time it takes to only load the license? What is the JDK version you are working with? The PDF generation time can vary depending upon how much content you are processing to generate the PDF. We can further proceed if you can share some more details.

In my .Net project, I include the license as an embedded resource (a hidden file that never gets copied, but resides within the exe for quick access). Does Java have an equivalent for that?

@JessIsCoding

Yes, Java provides a way to embed resources within the JAR file of your application. This is similar to how you can embed resources in a .NET executable. You search on Google or some other site for the tutorial in order to create JAR this way. In case you need any other information, please feel free to let us know.