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

Invalid entry in XRef table, ID=67, Generation=0, Position=0
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3887
Page 1 of 1

Author:  Siarhei Kuchuk [ Wed Dec 05, 2018 3:51 pm ]
Post subject:  Invalid entry in XRef table, ID=67, Generation=0, Position=0

Hello

We face issue that PDF Sharp can’t open the PDF file that provided by our customer. Demo project can be downloaded here
https://galuza-my.sharepoint.com/:u:/g/ ... g?e=UW0hMy

We’re using nuget package PDFsharp.1.50.4845-RC2a via the following code snippet.
Code:
            try
            {
                using (var reader = PdfReader.Open(pdfPath, PdfDocumentOpenMode.ReadOnly))
                {
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Console.ReadLine();
            }


Expected result:
Code:
no exception happens.


Actual result:
Code:
PdfSharp.Pdf.IO.PdfReaderException: Invalid entry in XRef table, ID=67, Generation=0, Position=0, ID of referenced object=4, Generation of referenced object=0


Could you please take a look into it?

Author:  Thomas Hoevel [ Thu Dec 06, 2018 3:09 pm ]
Post subject:  Re: Invalid entry in XRef table, ID=67, Generation=0, Positi

Hi!
Siarhei Kuchuk wrote:
Could you please take a look into it?
The exception says the file is corrupt. I don't think there is more to say about it.
Adobe Reader does a good job opening (and fixing) corrupted files. PDFsharp was designed to handle intact files and has limited capabilities with respect to fixing corruption.

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