Aspose Total license error for Aspose PDF

I have a Java application that uses both Aspose Imaging and Aspose PDF. I can set the license for Aspose Imaging but get an error when attempting to set it for Aspose PDF. The code to set the license is:
com.aspose.imaging.License iLicense = new com.aspose.imaging.License();
com.aspose.pdf.License pLicense = new com.aspose.pdf.License();

	pLicense.setLicense( DocumentUtilities.class.getClassLoader()
			.getResourceAsStream("META-INF/lib/Aspose.Total.Java.lic"));
	iLicense.setLicense( DocumentUtilities.class.getClassLoader()
			.getResourceAsStream("META-INF/lib/Aspose.Total.Java.lic"));

NOTE - if the imaging license is set first it works OK but the PDF license always fails, whether it is invoked before or after imaging.

The exception thrown is:
org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 3; The element type “License” must be terminated by the matching end-tag “”.

As far as I can see the Aspose Total license file is fine (it does have a closing element) and like I said the Aspose Imaging license works fine.

@peter.finn

Thanks for contacting support.

Would you please share your license file in a private message with us. Also, please share which version of the API you are using in our environment. We will test the scenario in our environment and address it accordingly. In order to send a private message, you may please click on username in the thread and use “Message” button.

@peter.finn

Thanks for sharing license file in private message.

We have tested the scenario in our environment while using your license file and were unable to notice the issue, which you have mentioned. The license was set correctly for both Aspose.PDF and Aspose.Imaging APIs. Would you please share a sample console application, which is able to reproduce the error. This would help us replicating the issue in our environment and address it accordingly.

I’ve been working on other things for a while and am just getting back to this issue now.

I tried a console application loading the license with a FileInputStream and that worked but that isn’t helpful as the actual operating environment is in a J2EE container in JBoss and the license has to be loaded with ClassLoader().getResourceAsStream(). Doing so works fine for Aspose Cells and Aspose Imaging but always fails for Aspose PDF. The error message for PDF is:
The element type “License” must be terminated by the matching end-tag ""

My test code is:

	com.aspose.imaging.License iLicense = new com.aspose.imaging.License();
	com.aspose.pdf.License pLicense = new com.aspose.pdf.License();
	com.aspose.cells.License cLicense = new com.aspose.cells.License();

	InputStream licStream = DocumentUtilities.class.getClassLoader().getResourceAsStream("META-INF/lib/Aspose.Total.Java.lic");
	cLicense.setLicense(licStream);
	
	licStream = DocumentUtilities.class.getClassLoader().getResourceAsStream("META-INF/lib/Aspose.Total.Java.lic");
	iLicense.setLicense(licStream);
	
	licStream = DocumentUtilities.class.getClassLoader().getResourceAsStream("META-INF/lib/Aspose.Total.Java.lic");
	pLicense.setLicense(licStream);
	licStream.close();

@peter.finn

Thanks for getting back to us.

We have tested the scenario in console as well as in web application using your license file with latest version of the API i.e. Aspose.PDF for Java 18.6 and did not notice any issue. As requested earlier, it would be much appreciated if you can please share a sample application which is able to reproduce the issue you are facing. Before sharing the sample application, we request you to please test the scenario with latest version as well.

Thank you for your quick response. I have tested with 18.6 with no change in behavior. I’d like to try an experiment to see if it’s just my license file the license loader has a problem with. Would it be possible to get a temporary license just for Aspose PDF and I can try loading that? In parallel I’ll continue to work on creating a JBoss J2EE application that doesn’t contain any of our application code as a test platform.

I think we can close this one it seems to be working OK now. I wrapped the InputStrean in a BufferedInputStream and PDF license worked OK (Word, Image and Cells license worked fine with a raw stream). Based on the message about the license had to be terminated with I think maybe PDF License thought the stream was exhausted while it still had characters available. Anyhow like I said it seems to be working now, thanks.

@peter.finn

Thanks for your feedback.

It is good to know that things have started working on your side. Please keep using our API and in event of any further query, please feel free to ask.