Workaround for the PDFSharp error: Cannot handle iref streams

[July 09 2012 Update] As some people have emailed and commented, another option to work around this solution is to plugin iTextSharp and use that for opening PDFs older than ver 5. The workaround can be found over on the PDFSharp forums http://forum.pdfsharp.net/viewtopic.php?f=2&t=693#p5855. I decided against this option myself as it would have required me to install and setup another third party library which I didn't want to do.

[Original Article]

I use PDFSharp with my ,net projects as a great way to produce invoices for our online stores. Some of our customers supply us with blank PDFs and we use these as templates when generating a new invoice.

I was given a PDF recently that was encoded using Adobe Acrobat 9. Normally we don't have any issues but this file was throwing the following error any time I wanted to open it:

cannot handle iref streams. the current implementation of pdfsharp cannot handle this pdf feature introduced with acrobat 6

It turns out that the encoding a PDF form above ver 5 gives PDFSharp a bit of a headache. The solution for us was to simply re-save the file with Adobe Reader v5 format. We were able to do this using Adobe Acrobat or Photoshop.

blog comments powered by Disqus

Get In Touch

Follow me online at TwitterFacebook or Flickr.

You can also contact me by email.

Buy Me A Coffee

Latest Tweets


Buy Me A Coffee