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

PdfReaderException: endobject
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4888
Page 1 of 1

Author:  AndreasGey76 [ Fri Oct 24, 2025 11:48 am ]
Post subject:  PdfReaderException: endobject

I have a pdf where an object ist finished with "endobject" instead of "endobj".

Example PDF Part:

8 0 obj
<< /Length 3910
/Subtype /XML
/Type /Metadata
>>
stream
...
endstream
endobject

Than the following exception is raised:

PdfSharp.Pdf.IO.PdfReaderException
HResult=0x80131500
Message=Token 'endobject' was not expected.
Source=PdfSharp-wpf
StackTrace:
at PdfSharp.Internal.ParserDiagnostics.ThrowParserException(String message)
at PdfSharp.Pdf.IO.Parser.ReadObjectInternal(PdfObject pdfObject, PdfObjectID objectID, Boolean includeReferences, Boolean fromObjectStream, SuppressExceptions suppressObjectOrderExceptions)
at PdfSharp.Pdf.IO.Parser.ReadIndirectObject(PdfReference pdfReference, SuppressExceptions suppressObjectOrderExceptions, Boolean withoutDecrypting)
at PdfSharp.Pdf.IO.Parser.ReadAllIndirectObjects()
at PdfSharp.Pdf.IO.PdfReader.OpenFromStream(Stream stream, String password, PdfDocumentOpenMode openMode, PdfPasswordProvider passwordProvider, PdfReaderOptions options)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, PdfDocumentOpenMode openMode, PdfReaderOptions options)

Other Tools, like Acrobat Reader oder PdfPig opens the PDF without error.
Is there a fix for this problem?

Author:  TH-Soft [ Sun Oct 26, 2025 4:45 pm ]
Post subject:  Re: PdfReaderException: endobject

AndreasGey76 wrote:
Other Tools, like Acrobat Reader oder PdfPig opens the PDF without error.
Is there a fix for this problem?
"endobj" is correct according to PDF specs and "endobject" is not correct.

Where does the "endobject" in the PDF come from? Was it edited manually? Was it created by a widespread software?
Is it worth changing PDFsharp to support this anomaly in PDF files?
Will Adobe Reader fix the PDF when you use "File => Save as" to save the PDF again?

Author:  AndreasGey76 [ Wed Oct 29, 2025 2:10 pm ]
Post subject:  Re: PdfReaderException: endobject

TH-Soft wrote:
AndreasGey76 wrote:
Other Tools, like Acrobat Reader oder PdfPig opens the PDF without error.
Is there a fix for this problem?
"endobj" is correct according to PDF specs and "endobject" is not correct.

Where does the "endobject" in the PDF come from? Was it edited manually? Was it created by a widespread software?
Is it worth changing PDFsharp to support this anomaly in PDF files?
Will Adobe Reader fix the PDF when you use "File => Save as" to save the PDF again?


The PDF comes from Producer "ReportsAnywhere".
Yes, Acrobat Reader fixes the PDF.

Author:  TH-Soft [ Wed Oct 29, 2025 3:29 pm ]
Post subject:  Re: PdfReaderException: endobject

AndreasGey76 wrote:
The PDF comes from Producer "ReportsAnywhere".
I could not find that product or company doing a quick Internet and AI search.
Do you have further information?

Maybe "endobject" was the work of a different producer.
Since there was only 1 reported case and we do not even have a PDF yet, I see no point in adapting PDFsharp for that anomaly.

Author:  AndreasGey76 [ Thu Oct 30, 2025 7:14 am ]
Post subject:  Re: PdfReaderException: endobject

TH-Soft wrote:
AndreasGey76 wrote:
The PDF comes from Producer "ReportsAnywhere".
I could not find that product or company doing a quick Internet and AI search.
Do you have further information?

Maybe "endobject" was the work of a different producer.
Since there was only 1 reported case and we do not even have a PDF yet, I see no point in adapting PDFsharp for that anomaly.



Here ist the "Creation Entry" from the pdf:
<< /CreationDate (D:20251006114013) /Creator (ReportsAnywhere http://www.reportsanywhere.com) /Producer (ReportsAnywherev6.0.83) /Title (RGTPAUNTENZF) >>

And here ist the object with the "endobject"-Tag as end:
8 0 obj
<< /Length 3910
/Subtype /XML
/Type /Metadata
>>
stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
<dc:title>
<rdf:Alt>
<rdf:li xml:lang="x-default">RGTPAUNTENZF</rdf:li>
</rdf:Alt>
</dc:title>
<dc:creator>
<rdf:Seq>
<rdf:li>Faktura</rdf:li>
</rdf:Seq>
</dc:creator>
</rdf:Description>
<rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="" xmp:CreateDate="2025-10-06T09:40:13.792966500Z" xmp:CreatorTool="Writer" xmp:ModifyDate="2025-10-06T09:40:13.792966500Z"/>
<rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" pdf:Producer="ReportsAnywhere v6.0.83" rdf:about=""/>
<rdf:Description xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" rdf:about="" xmpMM:DocumentID="c89e1d2f-d8a3-447a-9868-6896ac9d4066" xmpMM:VersionID="0"/>
<rdf:Description xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/" pdfaid:conformance="U" pdfaid:part="3" rdf:about=""/>
<rdf:Description xmlns:fx="urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#" rdf:about="">
<fx:DocumentType>INVOICE</fx:DocumentType>
<fx:DocumentFileName>factur-x.xml</fx:DocumentFileName>
<fx:Version>1.0</fx:Version>
<fx:ConformanceLevel>EN 16931</fx:ConformanceLevel>
</rdf:Description>
<rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"
xmlns:pdfaField="http://www.aiim.org/pdfa/ns/field#"
xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#"
xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#"
xmlns:pdfaType="http://www.aiim.org/pdfa/ns/type#"
rdf:about="">
<pdfaExtension:schemas>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<pdfaSchema:schema>Factur-X PDFA Extension Schema</pdfaSchema:schema>
<pdfaSchema:namespaceURI>urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#</pdfaSchema:namespaceURI>
<pdfaSchema:prefix>fx</pdfaSchema:prefix>
<pdfaSchema:property>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>DocumentFileName</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>name of the embedded XML invoice file</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>DocumentType</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>INVOICE</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>Version</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>The actual version of the ZUGFeRD data</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>ConformanceLevel</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>The conformance level of the ZUGFeRD data</pdfaProperty:description>
</rdf:li>
</rdf:Seq>
</pdfaSchema:property>
</rdf:li>
</rdf:Bag>
</pdfaExtension:schemas>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="r"?>

endstream
endobject

Author:  () => true [ Thu Oct 30, 2025 2:38 pm ]
Post subject:  Re: PdfReaderException: endobject

Thanks for the feedback.

it would be good to have the PDF file for analysis and, if we decide to support it, for testing.

The URL is for sale. Do you have any other information about the company?

Author:  AndreasGey76 [ Mon Nov 10, 2025 8:12 pm ]
Post subject:  Re: PdfReaderException: endobject

() => true wrote:
Thanks for the feedback.

it would be good to have the PDF file for analysis and, if we decide to support it, for testing.

The URL is for sale. Do you have any other information about the company?


Sorry, I have no additional informations, it is a PDF from one of pur customers.
How should I send it to you?

Btw: PDF Pig for example can read the document.

Author:  Thomas Hoevel [ Wed Nov 12, 2025 12:43 pm ]
Post subject:  Re: PdfReaderException: endobject

Hi!
AndreasGey76 wrote:
How should I send it to you?
Please mail it to "issues (at) pdfsharp.net".
Thanks.

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