I want to convert an HTML file into a PDF file using wkhtmltopdf
. wkhtmltopdf
is the best option for me as it renders the HTML file using WebKit. The problem is that I want to do the same using Java but wkhtmltopdf
does not provide any Java API.
I can use Runtime.exec()
or ProcessBuilder
to fork a new process from Java and create the PDF output using wkhtmtopdf
in that process. But, as I am developing a web based application, I am not allowed to create so many new processes in the server.
Is there any other way so that I can use wkhtmltopdf
? I really want to use it as it's giving me the exact output.
Or, is there any other open source browser engine that provides a Java API that can render my HTML page just like wkhtmltopdf
?
Give htmltopdf-java a try. It uses the native libraries generated by wkhtmltopdf
, so you should expect the same result with more control over the flow.
(I am the author of this library)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With