Hi,
hopefully the below issue can be solved with your help.
First of all:
I already had NP Problems converting HTML to PDF that manifested themselves in a similar way and could be traced back to missing fonts - this does not seem the case here.
I have already tested various call options with HTML load Options etc. - nothing worked.
My current installation is 25.8, but I also got the same error with 25.12. Java Version 11.
Problem Description:
When using the HTML to PDF conversion in java, NP in the aspose-pdf library occurs when started from the application.
The identical HTML file is converted in a unit test without any problems. Also an extended unit test with call of the converter method directly in the jar file - as it also takes place from the app works. As far as I can see, the call in both cases does not differ in any settings or parameters. The unit test runs on the same machine as the application. Both share the same Linux environment.
I must check up if the HTML file causing the NP can be attached here.
The NP:
Caused by: java.lang.NullPointerException
at com.aspose.pdf.internal.l114v.l0p.lI(Unknown Source)
at com.aspose.pdf.internal.l114v.l1p.lI(Unknown Source)
at com.aspose.pdf.internal.l114v.ld$9.lI(Unknown Source)
Code snip:
String base = in.getParentFile().toURI().toString();
String html = Files.readString(in.toPath(), UTF_8);
String withBase = html.replaceFirst("(?is)<head\b[^>]*>", "<head><base href=\"" + base + "\">");
try (com.aspose.pdf.Document doc = new com.aspose.pdf.Document()) {
doc.setPageInfo(pageInfo); // set BEFORE adding pages
com.aspose.pdf.Page page = doc.getPages().add();
com.aspose.pdf.HtmlFragment frag = new com.aspose.pdf.HtmlFragment(withBase);
page.getParagraphs().add(frag);
doc.save(out.getAbsolutePath());
}
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
The ticket has recently been logged in our issue tracking system and we will prioritize it on first-come, first-served basis. As soon as we make some progress towards its resolution, we will let you know via this forum thread. Please be patient and spare us some time.
@asad.ali
We are getting pressure from our customer to get that fixed. Is there any way for a workaround to prevent the NP to support our customer quickly.
Do you offer any alternative support options for customers with licensed libs, or is this the only forum?
Hi, clh
We are glad to welcome you to our community.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies. Issue ID(s): PDFJAVA-45855 - Status : Open
You can access Paid Support Services if you require priority support, along with direct contact with our Paid Support management team.
Unfortunately, there are currently no other options. I’ve escalated the issue’s priority to ‘Medium’. Issue ID(s): PDFJAVA-45855 - Priority: Medium
P.S. Please note that issues related to classes in the Aspose.Pdf namespace should be posted on the Aspose PDF product family support forum, except for Aspose.Pdf.LowCode namespace. Issues related to low-code products (plugins) should be posted on this - Free Support Forum - aspose.net forum. This small misunderstanding won’t stop us from solving your problem. There’s no need to start a new thread.
thank you for the info. We found that running with java 21 there is a little more info on the NPE:
java.lang.NullPointerException: Cannot invoke "com.aspose.pdf.internal.l113f.le.l5k()" because "<parameter1>" is null
at com.aspose.pdf.internal.l114v.l0p.lI(Unknown Source)
at com.aspose.pdf.internal.l114v.l1p.lI(Unknown Source)