开发者

Writing a HTML table to PDF in java [duplicate]

开发者 https://www.devze.com 2023-02-06 12:28 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicates: Converting HTML Files to PDF
This question already has answers here: Closed 12 years ago.

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

  1. DocBuilder to parse out the HTML in String Arrays, if you do not have it already
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号