Eden Ridgway's Blog

.Net and Web Development Information

  Home :: Contact :: Syndication  :: Login
  105 Posts :: 1 Stories :: 78 Comments :: 3 Trackbacks

Search

Article Categories

Archives

Post Categories

Development

General

For quite some time I have searched for an elegant free way of generating PDF files in .Net. My unfortunate work colleagues used to get spammed with emails about this library or a different approach, but at last I think my searching may be at an end. I had come across the iTextSharp (http://itextsharp.sourceforge.net/) library before but I didn't realise that one could generate a PDF file from XML. Previously it looked like one had to code declarations to add paragraphs, titles, etc. to the document. As it turns out (or maybe it has simply advanced since my first encounter with the library) it can also generate HTML and RTF (using an extension package).

Looking at the example of pdf generated from an XML file, this could be very useful in my current project where we need to generate a pdf file from a potentially modifiable template document. I'm thinking that the document template could be stored as XML and when we generate the pdf file we do the following:

  1. Replace placeholders for information such as name and add in any extra clauses etc.
  2. We could apply an XSLT transform to convert the resultant XML document into the format expected by iTextSharp
  3. And feed the result through iTextSharp and stream the output back to the web client.

As an aside, he following site seems to be quite a useful XSLT resource: http://www.informatik.hu-berlin.de/~obecker/XSLT/

posted on Wednesday, July 06, 2005 4:12 AM
Comments have been closed on this topic.