PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Unhandled exception opening pdf files, possible bug.
https://forum.pdfsharp.net/viewtopic.php?f=3&t=358
Page 1 of 1

Author:  xpehybcem [ Wed Apr 02, 2008 2:28 pm ]
Post subject:  Unhandled exception opening pdf files, possible bug.

Hi,

I think I found a bug. I cannot open PDF files generated by PDF-XChange.
I get this assertion:

Unhandled Exception: PdfSharp.Pdf.IO.PdfReaderException: Cannot handle iref streams. The current implementation of PDFsharp cannot handle this PDF feature introduced with Acrobat 6.

at PdfSharp.Pdf.IO.Parser.ReadXRefTableAndTrailer(PdfReferenceTable xrefTable) in Parser.cs:line 741
at PdfSharp.Pdf.IO.Parser.ReadTrailer() in Parser.cs:line 718
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider) in PdfReader.cs:line 275
at PdfSharp.Pdf.IO.PdfReader.Open(String path, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider provider) in PdfReader.cs:line 200
at PdfSharp.Pdf.IO.PdfReader.Open(String path) in PdfReader.cs:line 216 at ProtectDocument.Program.Main(String[] args)

I can open these files in Acrobat 8 without any problems. To make it work, I converted the PDF files to the PostScript format and then used the Acrobat Distiller to create the pdf files and it works, but it takes many steps. It would be nice to work with those files using PdfSharp directly.

How can I fix this?

Thanks in advance.

Author:  Thomas Hoevel [ Wed Apr 02, 2008 3:00 pm ]
Post subject: 

Hello!

We can only fix it if we can replicate it.
Therefore we need a PDF file that causes this error (I'll send you an email address via PM).

Author:  Thomas Hoevel [ Thu Apr 03, 2008 3:23 pm ]
Post subject:  Re: Unhandled exception opening pdf files, possible bug.

Hello!
xpehybcem wrote:
Unhandled Exception: PdfSharp.Pdf.IO.PdfReaderException: Cannot handle iref streams. The current implementation of PDFsharp cannot handle this PDF feature introduced with Acrobat 6.

I should have read your post more carefully. :oops:

This is not a bug, but a new PDF feature that is not yet supported in PDFsharp.
Cannot tell you when it'll be supported. :cry:

If you create those files yourself: create files for Adobe Reader 5.0 to avoid this new, unsupported feature.
If these are 3rd party PDF files, ask for Reader 5.0 compatible versions or try to automize your conversion.

I cannot fix PDFsharp and I can't tell you how to fix it.
I hope this helps anyway.

Author:  xpehybcem [ Tue Apr 08, 2008 5:13 pm ]
Post subject: 

Thomas,

You have been very helpful. I generated the files using the Acrobat 5 compatibility option and was able to modify files directly using PDFSharp.

Thanks again!!!.

Author:  DavesNotHere [ Thu Apr 02, 2009 6:33 pm ]
Post subject: 

I am having the same issue, oddly almost exactly a year after xpehybcem. Has this been resolved be the newest version (1.20 I think). I have an older version and didn't know if simply upgrading would solve my problem. Thanks.

Author:  Thomas Hoevel [ Tue Apr 07, 2009 8:10 am ]
Post subject: 

AFAIK this is not yet fixed with version 1.20.

Author:  DavesNotHere [ Wed Apr 08, 2009 12:44 pm ]
Post subject: 

Not a huge problem. I did find a work around in this case, the Reduce File Size option worked for me.

Thanks for keeping an eye on it.

Author:  nwebster [ Wed Jun 03, 2009 3:25 pm ]
Post subject: 

What is really odd about this is that when I run this on my local machine, it works fine. But when I move it to our production server, it doesn't work. Has anyone come across this situation?

Edit: I was able to edit the pdf file in a hex editor and change the version from 1.5 to 1.4 and then pdfsharp handled it fine on all machines.

Author:  hmtech [ Thu Aug 27, 2009 3:54 pm ]
Post subject:  Re: Unhandled exception opening pdf files, possible bug.

I am too struggling with this. I am working with a pdf that can be opened with Acrobat 7.0 and later. The pdf version is 1.6. I am getting the error
'Cannot handle iref streams. The current implementation of PDFsharp cannot handle this PDF feature introduced with Acrobat 6.'

Has this been fixed or is there a workaround. Please let me know. I will appreciate your help.

I am using PDFSharp dll versionb 1.2.1269.0. I am using VB.Net. I don't have control on the version of the pdf.

Thanks

Author:  fshenrique [ Thu Oct 14, 2010 2:46 pm ]
Post subject:  Re: Unhandled exception opening pdf files, possible bug.

Friend ... I'm having the same problem and using version 1.31.1789.0 of PdfSharp. The system is 64 bit (Vista 64). Already there is a solution to the problem?
If you need I can send the pdf file by e-mail PM.

Thanks and hope your help.

Flavio

Author:  Thomas Hoevel [ Thu Oct 14, 2010 3:42 pm ]
Post subject:  Re: Unhandled exception opening pdf files, possible bug.

There is a workaround suggested in this thread:
viewtopic.php?p=2860#p2860

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/