convert from html to pdf and to image java
-
27-02-2021 - |
Question
Well, I DID READ ALMOST ALL THE QUESTIONS HERE ABOUT THIS TOPIC!
I need an API - not at tool to convert in a very high quality from PDF to image.
So I didn't find any direct tool, and I used: HTML to PDF and PDF to image.
I tried:
- PDFRenderer
- FDFBOX
- PDFONE
- HTML2IMAGE
- FLYING-SAUCE
- ITEXT
- JPEDAL
- PDFCrown
Only the commerical ones (PDFCrown and PDFBox) came out with good results.
I thought that Java is for open source projects!
Am I missing any library that prints out in a high quality images from HTML (could be also from PDF, I can pay for half the way..)
Solution
I used the wonderful tool:
It's very easy - just a command line.
Installation:
- Download from here the version. To windows I used:
wkhtmltox-0.11.0_rc1-installer.exe
file. - Run the installer
- Save your HTML to a file on your disk.
- In java,
Runtime.getRuntime().exec(wkhtmltopdf file.jpg myhomepage.jpg)
That's it! so easy to use:)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow