PCL Load Options null in Deployed Env but not locally

We are getting a strange exception now, but have our licenses set. The exception occurs when trying to convert a PCL file to PDF.

Exception: java.lang.NullPointerException: Cannot invoke “com.aspose.pdf.internal.pcl.parser.PCLParser.getOptions()” because the return value of “com.aspose.pdf.internal.pcl.composer.Composer.getParser()” is null

We are using aspose-pdf 20.6. Do you know how we can resolve this issue? It works locally, but does not work when deployed.

@drymers

Can you please try using Aspose.PDF for Java 23.8 and let us know if issue still persists? Please share your sample file with us as well so that we can test the scenario in our environment and address it accordingly.

PS: Also, make sure that all windows fonts are installed in the system where this exception is occurring.

Gotcha, thanks so much for the reply. We are getting a strange exception now, but have our licenses set. The exception occurs when trying to convert a PCL file to PDF.

Exception: java.lang.NullPointerException: Cannot invoke “com.aspose.pdf.internal.pcl.parser.PCLParser.getOptions()” because the return value of “com.aspose.pdf.internal.pcl.composer.Composer.getParser()” is null

We are using aspose-pdf 20.6. Do you know how we can resolve this issue? It works locally, but does not work when deployed.

@drymers

Can you please try using Aspose.PDF for Java 23.8 and let us know if issue still persists? Please share your sample file with us as well so that we can test the scenario in our environment and address it accordingly.

PS: Also, make sure that all windows fonts are installed in the system where this exception is occurring.

Hello, thanks for getting back to me. The system does have all the windows fonts. We do not currently have access to Aspose.PDF Java 23.8, is there a bridge solution available in our current version?

Also, the code fails on this line:
com.aspose.pdf.PclLoadOptions pclLoadOptions = new PclLoadOptions();

The file is attached T1Zip.zip (3.8 KB)

@drymers

Please check the attached output file that we obtained using 23.8 version of the API in our environment:

Document doc = new Document(dataDir + "T1.pcl", new PclLoadOptions());
doc.save(dataDir + "output23.8.pdf");

output23.8.pdf (6.5 KB)

Hello, we just updated to Aspose 23.7 and received the same error. The code is the exact same as yours. For whatever reason, the code works locally, but whenever it is tested in a deployed state we get the same exception on the stack trace as I showed you before.

@drymers

Please upgrade to 23.8 version. Also, make sure that all fonts are properly installed on the server. If you are using a non-Windows server, you can try installing msttcorefonts package. In case issue still persists, please share the server details with us so that we can further proceed to investigate accordingly.

Hello, where is aspose-pdf 23.8? The most recent version on your release repo (Aspose Repository Browser /java/repo/com/aspose/aspose-pdf/) appears as 23.7. Please advise.

@drymers

You can download it from the Package Explorer Tab on below link:

Hello @asad.ali, thank you for providing a link to 23.8. We switched the version and have code identical to yours. We are still encountering the issue. Are there any other steps we can take for remediation?

@drymers

Can you please share the environment details where your application is deployed? We will perform an investigation accordingly.

Our application is deployed on AWS in a Docker container. Pretty standard build config, on an EC2. The issue still persists across other environments too, yet it works fine locally. Are there any plans to triage this?

I suppose a follow up question is simply: is Aspose configured to run on Windows environments, Linux, etc.?

@drymers

Yes, Aspose.PDF for Java can be used in both Windows and Linux like environment. Can you please share your sample docker file that you have for your application?