JAVA - Conversion html to PDF

Hello !

We have some problem with conversion html to pdf process. We are working with latest version Aspose Pdf java 17.10. We got 2 main problem on it :

  • first : the performance about conversion. We are working on latest Aspose pdf version in process during around 12 seconds to generate a simple pdf. For our client, it’s not possible to wait so much time. Maximum delay is around 2 seconds maximum to get it. What is wrong ? Our development or the latest version ? i think, there is a trouble in the process. Maybe a problem to transform the Document object into ByteArrayInputStream ?

  • second : the visual of we want. The content is totally ok (font / style / etc) are awesome. But we are a lot of difficulty to place elements into header and footer. We need som help on java code to acheive our result. Can you help us to purpose the java code to get this example.pdf (70.4 KB) ?

Thanks for your answer and have a good day.


Thanks for contacting support.

Please note that performance of the API depends upon many factors like complexity and structure of input document, environment in which you are using the API, your program routine and number of threads etc. We will really appreciate if you can please share the sample code snippet along with your environment details (i.e OS Version, JDK Version, Application Type, etc).

I am afraid that currently there is no direct way to add header/footer in the PDF document, while generating it through HTML. However you can add header and footer in the generated PDF document after converting it from HTML. In order to add header/footer in the PDF, please check “Adding Text in Header/Footer section” article in our API documentation.

In case you experience any issue while achieving desired PDF document, please share your respective input HTML file with us. We will test the scenario in our environment and address it accordingly.