We are attempting to convert an HTML file with external CSS to a PDF. The resulting PDF looks as though the CSS is not being properly read. I tried to attach the HTML file in question, but it would not allow that format. I have included a link to the file on a live server at - https://www.toolweb.com/toolwebv3/_ui/desktop/jobberweb/html/test-flier.html
I am not sure if Aspose does not support the CSS we are trying to use, or if we are doing something incorrect on our end.
When using Google Chrome’s “Save As PDF” function, it comes out fine. If we can get a result somewhat close to that, that would be great.
Thank you.
Hi Joseph,
Can you please share which Aspose API are you using? Aspose.Words and Aspose.Pdf both support this feature.
Best Regards,
We have the Aspose.Total for Java, and are using the com.aspose.pdf.
Hi Joseph,
Thanks for your inquiry. Please note that you need to pass external resources (CSS/images/fonts) path in HtmlLoadOptions()
object as follows. However, I have noticed that the image is not being rendered in the resultant PDF, so I have logged a ticket PDFNEWJAVA-35180 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.
HtmlLoadOptions options= new HtmlLoadOptions("E:/data/temp");
options.getPageInfo().setWidth(600);
options.getPageInfo().setHeight(1000);
Document doc= new Document("E:/data/temp/Single_output.html",options);
doc.save("E:/data/temp/Single_output_files.pdf");
We are sorry for the inconvenience caused.
Best Regards,
The issues you have found earlier (filed as PDFNEWJAVA-35180) have been fixed in Aspose.Pdf for Java 11.6.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.