PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Sun Nov 16, 2025 2:44 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Oct 24, 2025 11:48 am 
Offline

Joined: Tue Jan 16, 2024 11:31 am
Posts: 10
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?


Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 26, 2025 4:45 pm 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1064
Location: CCAA
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?

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 29, 2025 2:10 pm 
Offline

Joined: Tue Jan 16, 2024 11:31 am
Posts: 10
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 29, 2025 3:29 pm 
Offline
PDFsharp Guru
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 1064
Location: CCAA
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.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 30, 2025 7:14 am 
Offline

Joined: Tue Jan 16, 2024 11:31 am
Posts: 10
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


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 30, 2025 2:38 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 355
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?

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 10, 2025 8:12 pm 
Offline

Joined: Tue Jan 16, 2024 11:31 am
Posts: 10
() => 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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 12, 2025 12:43 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3137
Location: Cologne, Germany
Hi!
AndreasGey76 wrote:
How should I send it to you?
Please mail it to "issues (at) pdfsharp.net".
Thanks.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 353 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group