2

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 page? Right now it is writing incomplete data on only one pdf page , remaining data is not written.

Community
  • 1
  • 1
yogsma
  • 10,142
  • 31
  • 97
  • 154
  • 3
    possible duplicate of [Converting HTML Files to PDF](http://stackoverflow.com/questions/633780/converting-html-files-to-pdf) and [many others](http://stackoverflow.com/search?q=java+html+to+pdf). Please search before you post. – Matt Ball Jan 25 '11 at 17:53
  • I am not converting HTML files. I did search actually before posting. – yogsma Jan 25 '11 at 17:57

3 Answers3

4

I believe you can use the iText API.

Chris
  • 56
  • 1
1

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.

Manidip Sengupta
  • 3,573
  • 5
  • 25
  • 27
1

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):

It uses a commercial product, but it works really well.

Jeroen Ritmeijer
  • 2,772
  • 3
  • 24
  • 31