PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.de/

Invalid entry in XRef table, ID=8, Generation=0, Position=0
http://forum.pdfsharp.de/viewtopic.php?f=2&t=4506
Page 1 of 1

Author:  borancy [ Tue Nov 07, 2023 3:23 pm ]
Post subject:  Invalid entry in XRef table, ID=8, Generation=0, Position=0

Hello,

I am using PdfSharp 1.50.5147 on a UWP app through NuGet. It works well for the most part.

But for some of the files that were produced on MacOS environment, when I call this PdfReader.Open(inStream, PdfDocumentOpenMode.Import); function, I'm getting the following error.
Invalid entry in XRef table, ID=8, Generation=0, Position=0, ID of referenced object=4, Generation of referenced object=0
at PdfSharp.Internal.ParserDiagnostics.ThrowParserException(String message)
at PdfSharp.Pdf.IO.Parser.ReadXRefTableAndTrailer(PdfCrossReferenceTable xrefTable)
at PdfSharp.Pdf.IO.Parser.ReadTrailer()
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)


I can open these files on the Adobe tools and browsers and once saved with the Adobe tools, the above function starts to work with those files.

Looking forward to hearing from you

Thank you

Author:  TH-Soft [ Wed Nov 08, 2023 8:25 am ]
Post subject:  Re: Invalid entry in XRef table, ID=8, Generation=0, Positio

borancy wrote:
I can open these files on the Adobe tools and browsers and once saved with the Adobe tools, the above function starts to work with those files.
The file is corrupted.
The strict check has been removed from newer versions of PDFsharp (I don't remember when).
So either get the latest version of PDFsharp or take the source code of PDFsharp 1.5 and comment that check out.
I don't know if version 1.51 still has that check.

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