Sunday 16 November 2008

Generating PDF files programmatically using .NET ...

Ever ran into a requirement where you had to generate a PDF file as an output from your .NET application (windows or web application) ? Well, it's not that tough to accomplish this and let me emphasize that "it's easy" :-)

I got a chance to work on a requirement like this where in I had to generate a big pdf file with lot of numbers presented in tables, colored text and a bunch of images - to be laid out neatly in the pdf.


I came across an open-source project (am a big fan of open source projects and I try my best to distribute my code too - SmartTimePicker) named - PDFSharp.

You can download the documentation and samples from this site, but for the benefit of all my readers, let me list down the highlights (as given on that site):
  • Creates PDF documents on the fly from any .Net language
  • Easy to understand object model to compose documents
  • One source code for drawing on a PDF page as well as in a window or on the printer
  • Modify, merge, and split existing PDF files
  • Images with transparency (color mask, monochrome mask, alpha mask)
  • Newly designed from scratch and written entirely in C#
  • The graphical classes go well with .Net

With PDFsharp, start producing pdfs that look professional, even without having to buy Acrobat writer ;-)

0 comments: