Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic PDF generation from template [closed]

I've a requirement to be able to generate PDF's within our (ASP.net) application. We need to meet the following requirements:

  1. The text will be largely dynamic and must be added programatically.

  2. Ideally we'd like to base these generated documents off PDF templates provided by our designers.

  3. Some of the sections/pages may or may not be visible depending on certain conditions - ideally we'd like the content to 'flow' upwards to fill the space when something is removed.

  4. Some of the pages may need to repeat, depending on certain conditions.

  5. Some of the PDF templates will be out of our control (we're populating application forms supplied by third parties), so being able to read in a blank PDF and populate it would be good.

I've looked at iTextSharp and it seems to do most of these things (i.e. I can take a PDF, edit it to include form fields where we need to fill data and then use iTextSharp to read that in as a template and populate the data), however, I'm not sure how then to go about potentially hiding whole sections and/or repeating pages.

What I'm looking for here is a little advice from anybody who's been in a similar situation.


Small update here, we went with iTextSharp - it's a powerful tool, but does take a bit of learning, however it's quick, light, and does precisely what we want it to do.

However...

I would point out that the latest version is no longer really free (as in beer) - the license does not permit commercial usage. As a result, we now have a licensed version, but it's not shockingly cheap (and they don't publish a price list).

like image 731
Paddy Avatar asked Jan 26 '10 09:01

Paddy


1 Answers

I would use iTextSharp. I create all kinds of PDF files based on different templates and iText has worked the best for me. It is a very powerful control and can manipulate pdf files in just about any way.

I'm not sure that iText can handle your third requirement. I know that it can create a pdf from a html file. Maybe use what Tomas posted and create the pdf with iText.

like image 80
Brian Avatar answered Oct 16 '22 06:10

Brian