Free Support Forum - groupdocs.com

Issue converting HTML/HTM to PDF


#1

Hello,

I’m using GroupDocs.Conversion Java version 17.7.1 and I’m running into an issue with the rendered PDF document when converting from certain HTML/HTM files. I haven’t been able to figure out a pattern, so I was wondering what type of support HTML/HTM to PDF conversion has? What are the known limitations for this type of conversion?

I have attached a zip which contains two files. The one named Working.html converts successfully. The one named NotWorking.html does not convert. Any insight into this would be greatly appreciated.

Here is the code block responsible for the conversion:

new License().setLicense(ConnectionHandler.class.getClassLoader().getResourceAsStream(“GroupDocs.Conversion.lic”));
ConversionHandler conversionHandler = new ConversionHandler(new ConversionConfig());
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setOutputType(OutputType.Stream);
response.getOutputStream().write(conversionHandler.convert(parts.get(0).getInputStream(), filename, saveOptions).toBytes());GroupDocs.zip (3.0 KB)

Thank you,

Robert Hunter


#2

@rhunter,

Thank you for your inquiry.
Can you please also share the output of problematic file? However, we observed that output of NotWorking.html file has only numbering/indexing issue using 17.12 version of the API. Hence, we’ve logged this in our internal issue tracking system with ID:CONVERSIONJAVA-526. As we have any update on it, we shall notify you.


#3

I’m getting java.lang.NullPointerException at conversionHandler.convert(parts.get(0).getInputStream(), filename, saveOptions)

[6/12/18 9:18:11:228 EDT] 00000163 webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[com.pyrasol.ecm.services.ConvertDocumentToPDF]: java.lang.NullPointerException
at com.groupdocs.conversion.internal.c.a.pd.internal.p473.z5.c(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p473.z5.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p469.z1.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p469.z2.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p469.z1.m7(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p466.z8.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p456.z9.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p450.z13.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p452.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p442.z3.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p522.z1.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p558.z1.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.internal.p521.z13.m1(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.fU.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.fU.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.ADocument.a(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.ADocument.(Unknown Source)
at com.groupdocs.conversion.internal.c.a.pd.Document.(Unknown Source)
at com.groupdocs.conversion.domain.a.k.r(Unknown Source)
at com.groupdocs.conversion.domain.a.k.a(Unknown Source)
at com.groupdocs.conversion.domain.a.a(Unknown Source)
at com.groupdocs.conversion.domain.b.a(Unknown Source)
at com.groupdocs.conversion.domain.b.a(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.b(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.b(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convert(Unknown Source)
at com.pyrasol.ecm.services.ConvertDocumentToPDF.doPost(ConvertDocumentToPDF.java:57)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:781)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1114)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:940)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)


#4

@rhunter,

We’d recommend you to use latest version of the API 17.12. And follow this article for code example. We are getting this output using v17.12 NotWorking.html.pdf (158.5 KB)
In this resultant PDF there is indexing/numbering issue that we have already logged in our issue tracking system.

In order to further investigate this issue, please share your development environment details.


#5

Thank you, upgrading to the latest version allows me to convert the document with the same output you’re getting. I look forward to hearing updates regarding the indexing/numbering issue!


#6

@rhunter,

We’re glad to know that your issue is resolved.

We’ll surely notify you as we have any update on this issue.