Possible Duplicates:
Converting HTML Files to PDF PDF file generation from XML or HTML
I have a table with content in html format , how do I write that table to PDF file in java?
I kind of get this working. I am using faceless pdf library. I have another doubt related to this still. Since I am writing data of html format in pdf , how can I get to know that I am at the end of page so I can print remaining data on next pa开发者_如何学Pythonge? Right now it is writing incomplete data on only one pdf page , remaining data is not written.
I believe you can use the iText API.
Use
- DocBuilder to parse out the HTML in String Arrays, if you do not have it already
- Use the orinoco library by Andy Khan to write out the PDF. Ref:
http://www.andykhan.com/orinoco/index.html
Good wishes, - M.S.
It depends a bit on the complexity of the HTML, if you need perfect conversion fidelity and run in a server environment then have a look at these blog post (which I wrote):
- Programmatically Converting Web / HTML pages to PDF format
- Java based web services interface
It uses a commercial product, but it works really well.
精彩评论