简体   繁体   中英

Java convert dynamic generated HTML content to PDF

Recently I am working on commercial project which requires to generate a PDF based on some dynamic HTML content, now I have implemented that with a java library called WKHTMLTOPDF ( http://wkhtmltopdf.org/ ) .

This library is a command line tool which user browser webkit as rendering engine, since I am new to java development, I am not sure whether there is any security or performance issue when using this library .

If this is not a good solution, is javascript plugin an alternative ?

Sorry for my english!:)

I've worked on the same sort of thing recently. I used iText and found it immensely useful. I haven't used WKHTMLTOPDF but I'm answering since you seem to explore more on other options which could be better, safer. iText has been here for a long while now, and it's pretty simple to use.

Follow these links for more info on iText, How to convert HTML to PDF using iText

And, Converting HTML files to PDF

A small/sleek tutorial http://hmkcode.com/itext-html-to-pdf-using-java/

If you are concerned about any sort of licensing issues follow,

Is iText 5.4.2 open source?

I found iText quite handy and is supported by a most of the browsers too. (Chrome, IE, Firefox, I haven't tested on res of them) Hope this helps.

I would suggest you to use PD4ML library available purely in JAVA .It is easy to use and generates PDF from HTML (dom) quickly.

http://www.pd4ml.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM