Hello. I’m trying to generate pdf from html using java code based on example from your site
Document doc = new Document(“myhtmlfile.html”, new HtmlLoadOptions());
doc.save(TEMP_DIR + “myfile.pdf”);
and it takes 18 seconds to form pdf. for my system it’s critically slow. Is there any way to get it faster? in one or two seconds? I have all css styles included into html, so i don’t need to download them from filesystem. or may be there is another way to get pdf from html?
Consult me, please.
Thank you.
@pythagoreantree
Thanks for contacting support.
Please note that the performance of the API depends upon many factors to be noticed i.e Working Environment, API Version, Complexity and Structure of source file, etc. We would really appreciate if you can please share your sample HTML file along with your environment details (e.g OS, JDK Version, Application Type etc.) - so that we can test the scenario in our environment and address it accordingly.
OS: Windows 7/RHEL 7.1 - the result is the same
JDK version: 1.7
Application Type: web-application based on osgi architecture deployed on webshpere application server
test html file: https://drive.google.com/file/d/10_v7t-ZREfII_LdwkTKu7obXii7oZdfT/view?usp=sharing
Initialization of HtmlLoadOptions takes most of the time.
and pdf doc itself is saved fluently
@pythagoreantree
Thanks for sharing the sample file.
We have tested the scenario in our environment and observed that API took ~20 seconds, in order to complete the conversion. However, we have logged an investigation ticket as PDFJAVA-37497 in our issue tracking system. We have also shared your concerns with the logged ticket - so that respective team can further look into this accordingly. As soon as we have some definite updates regarding resolution of the logged ticket, we will let you know. Please be patient and spare us little time.
We are sorry for the inconvenience.
~20 seconds is much for our system, it can cause significant performance issue.
I achieved better results with aspose.words ~3 seconds
It’s much better, but still a little bit slow.
Actually html to pdf convertion is an expensive operation due to its specificity.
Nevertheless, thank you for the issue. Hope, you will find a way to make it faster.
@pythagoreantree
Thanks for writing back.
We have recorded your recent concerns and raised them to respective team as well. We will let you know once a significant progress is made towards resolution of the logged ticket. Please spare us little time.
We are sorry for the inconvenience.