Archive

Archive for October, 2012

PDFSharp Bug Workaround

October 23, 2012 Leave a comment

So I’m using PDFSharp to insert page numbers into some PDF files at work. The problem was that somehow the page width was being truncated on save,s o any landscape pages would get cut off.

The solution is to make a new PDFDocument and add the pages from the existing PDFDocument to it, and then overwrite the original document (since for whatever reason, the save method on the new instance of the document doesn’t affect the page widths).

PDFSharp makes PDF operations super easy, but man is it a buggy library.