I am trying to convert the html to pdf but the pdf output is cutting the data on the right side. Please find the attached html and pdf.
Here is the code used for conversion
HTMLDocument htmdoc = new HTMLDocument(file);
HtmlRenderer renderer = new HtmlRenderer();
PdfRenderingOptions option = new PdfRenderingOptions();
renderer.render(new PdfDevice(option, destFile), htmdoc);
I got it fixed by specifying the setAdjustToWidestPage(true). Now it looks good except that for 1 table the data doesn’t fit inside the column, it overflows outside. Attached the image Screen Shot 2020-04-26 at 9.28.35 PM.png (26.2 KB)
By the way I don’t think ‘setAdjustToWidestPAge’ fixes the issue properly as I want the table width same as in html in pdf instead of just expanding to fit to page size.
Another issue. I have an image at the beginning of html which is moved to the end of pdf after conversion.
We have logged an investigation ticket as HTMLJAVA-388 and I have mentioned all the details in in our issue tracking system. We will further investigate the scenario in details and keep you posted with the status of ticket resolution. Please spare us little time.
By the way I have an html file which I parse and do something using HTMLDocument class. Now that if I want to write this to outputstream or convert it to byte[]?
I like to inform this issue has been added recently in our issue tracking system and as per our company policy, the first priority for investigation is given to the Paid Support i.e. Enterprise and Priority Support on first come first serve basis. After that the issues from normal support forum are scheduled for investigation on first come first serve basis. I request for your patience and we will share good news with you soon.
We are a paid customer and we are in the process of renewing again. May be this is not the right place for paid customer. Please direct me to the right place if this is not
Just checking if in case there is any update on this issue. We are in the process of renewing our license. We should have the license by next week. As the process takes time.
I see the issue is still open in this thread… Just interested to know when we can expect it to be fixed?
I can’t see the issue description. I am hoping that this issue addresses both ‘content not fitting into table cell’ and the ‘image going to bottom’ during pdf conversion.
I was converting html to pdf. It used to work before but now suddenly am getting this below error
Caused by: java.lang.NullPointerException
at sun.lwawt.macosx.LWCToolkit.getScreenWidth(LWCToolkit.java:362)
at sun.awt.SunToolkit.getScreenSize(SunToolkit.java:645)
at com.aspose.html.internal.p248.z6$1.invoke(Unknown Source)
at com.aspose.html.internal.p248.z6.m2(Unknown Source)
at com.aspose.html.internal.p266.z1.(Unknown Source)
at com.aspose.html.internal.p152.z4.m1(Unknown Source)
at com.aspose.html.internal.p152.z2.m5(Unknown Source)
at com.aspose.html.collections.z2.m73(Unknown Source)
at com.aspose.html.collections.z2.hasNext(Unknown Source)
at com.aspose.html.internal.p248.z1.m1(Unknown Source)
at com.aspose.html.rendering.HtmlRenderer.render(Unknown Source)
at com.aspose.html.rendering.HtmlRenderer.render(Unknown Source)
at com.aspose.html.rendering.Renderer.render(Unknown Source)
at com.aspose.html.rendering.Renderer.render(Unknown Source)
Here is the code that does the conversion
HTMLDocument htmdoc = new HTMLDocument(new ByteArrayInputStream(htmlFile),".");
// render to PDF & XPS
ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();
HtmlRenderer renderer = new HtmlRenderer();
PdfRenderingOptions option = new PdfRenderingOptions();
PageSetup ps = new PageSetup();
ps.setAdjustToWidestPage(true);
option.setPageSetup(ps);
renderer.render(new PdfDevice(option, pdfOut), htmdoc);
return pdfOut.toByteArray();
I like to inform that we are working on this and will share good news with you soon. Also for your new issue please create new thread and share sample files with us to further investigate this issue on our end.
Please file an issue for this as this is frustrating that we cannot use extended monitor connected to our laptop while generating the report else it will throw this error. I had to disconnect my monitor to work on this.
We did buy the license and sent them the issues which I reported in this thread to the paid support team, even with paid support the issue is still not fixed. They are saying that it;s being analyzed since 19th june.
following are 2 issues reported. You mentioned that with paid support the issue gets resolved soon but so far not. Is there any reason why it takes so long to fix this?
Please accept our humble apology for the delay and inconvenience caused.
Please note that paid support does not guarantee any immediate solution but it does expedite the investigation process in terms of getting an ETA. Nevertheless, both of your paid support issues are under the phase of investigation and due to their nature of complexity, they require some more time to get fully investigated.
We assure you that you will be notified about the ETA in respective posts as soon as the investigation of the issues is completed. We greatly appreciate your patience in this matter. Please spare us some time.