PDF Report generation

Posted by IniTech on Stack Overflow See other posts from Stack Overflow or by IniTech
Published on 2009-12-30T15:57:26Z Indexed on 2012/12/20 5:03 UTC
Read the original article Hit count: 280

Filed under:
|
|
|
|

EDIT : I completed this project using ABCpdf. For anyone interested, I love this product and their support is A+. Everything I listed as a 'Con' for the HTML -> PDF solution was easily doable in ABCpdf.


I've been charged with creating a data driven pdf report. After reviewing the plethora of options, I have narrowed it down to 2. I need you all to to help me decide, or offer alternatives I haven't considered. Here are the requirements:

  1. 100% Data driven
  2. Eventually PDF (a stop in HTML is fine, so long as it is converted)
  3. Can be run with multiple sets of data (the layout is always the same, the data is variable)
  4. Contains normal analysis-style copy (saved in DB with html markup)
  5. Contains tables (data for tables is generated at run-time)
  6. Header/Page # on each page
  7. Table of Contents
  8. .NET (VB or C#)
  9. Done quickly

Now, because of the fact that the report is going to be generated with multiple sets of data, I don't think a stamped pdf template will work since I won't know how long or how many pages a certain piece of the report could require.

So, I think my best options are:

  1. Programmatic creation using an iText-like solution.
  2. Generate in HTML and convert to PDF using a third-party application (ABCPdf is the tool I have played with so far)

Both solutions have their pro's and con's.

Programmatic solution:

Pros:

  1. Flexible
  2. Easy page numbering/page header/table of contents
  3. Free

Cons:

  1. Time consuming (to write a layer on top of iText to do what I need and keep maintainable)
  2. Since the copy is already stored in the db with html markup, I would have to parse through the data before I place it into the pdf, ensuring I don't have to break the paragraph into chunks so I can apply bold, italic, underline, etc. to specific phrases. This seems like a huge PITA, and I hope I am wrong about that assumption.

HTML -> PDF

Pros:

  1. Easy to generate from db (no parsing necessary)
  2. Many tools for conversion
  3. Uses technology I am already familiar with
  4. Built-in "Print Preview" - not a req, but nice

Cons:

(Edited after project completion. All of my assumptions were incorrect and ABCpdf is awesome)

1. Almost impossible to generate page headers - Not True
2. Very difficult to generate page numbers Not True
3. Nearly impossible to generate table of contents Not True
4. (Cross-browser support isn't a con; Since its internal, I can dictate what browser to use)
5. Conversion tool quirks - may not convert exactly as rendered in browser Not True
6. Overall, I think it would be very hard to format the HTML exactly as I would want it to appear/convert to PDF. Not True

That's it - I need the communitys help in deciding which way I should go. I might be wrong about some of my Pro/Con assumptions. If I am, please tell me. All thoughts and suggestions are welcome and appreciated.

Thanks

© Stack Overflow or respective owner

Related posts about html

Related posts about css