Basic PDF editing in .NET

24. May 2011 18:24

At work we have a program that allows us to batch print many documents at once.  This program is many moons old and has seen better days and well with my company upgrading to windows 7 the program has simply stop working all together in some cases.  Right now this program is really only used for batch printing PDF files, so I suggested that we use an open source pdf library to combine the pdfs and serve up one large pdf file for our users to print.  My boss agreed and so this evening I have found an open source library and did just that.  I am using PDFsharp to do this.  It literally too me ten mintues and six lines of code to do this.  I was plesently shocked about how easy it was todo this.  It was literally as easy as opening two docments, creating a new one and adding the page(s) from the seperate documents to the new one.  Simple.  source is attached and based on the sample from PDFsharp http://www.pdfsharp.net/wiki/ConcatenateDocuments-sample.ashx, it builds and run on mono 2.6 on Ubuntu and should run on any .NET 2.0 or higher, enjoy!

PdfPlay.zip (240.42 kb)

About the author

John Moore is a C# and .NET developer for Associated Electric Coop (aeci.org) in Springfield Missouri, USA.  I am also a Mono and .NET linux developer in my free time.  I am the author of the banshee-ampache extension.  If you are interested in my work then please look at the extension's source. Please file a bug or contact me with any issues.  Finally a link to my Resume.