PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 7:00 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Feb 17, 2017 4:20 pm 
Offline

Joined: Thu Feb 16, 2017 2:49 pm
Posts: 1
Hello,

I use PDFSharp to open multiple PDF files to concatenate them to one big, single PDF. This was working for some time now.
"Suddenly" an exception is thrown at PdfReader.Open(file...: Token 284 was not expected.

The guy who is creating the PDFs says, he did not change anything :roll: , he just creates the input PDFs from word, like always.
I opened the one failing PDF in notepad++ and saw at the end:
Code:
trailer
<</Size 116/Root 1 0 R/Info 10 0 R/ID[<AD0C81255325DE47A6D4ED8895969123><AD0C81255325DE47A6D4ED8895969123>] >>
startxref
29472
%%EOF
xref
0 0
trailer
<</Size 116/Root 1 0 R/Info 10 0 R/ID[<AD0C81255325DE47A6D4ED8895969123><AD0C81255325DE47A6D4ED8895969123>] /Prev 29472/XRefStm 29030>>
startxref
31951
%%EOF

Since I don't know too much about PDF internals I thought: Hey, why is there a second %%EOF and removed the last "trailer .... %%EOF" part and then I was able to open that PDF with PDFSharp again.
Then I looked at some older, formelry working PDF and saw the same, doubled trailer ... %%EOF parts at the end, so that can not be the problem.

Can somebody help to fix that problem?

Best regards,
Alex


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 20, 2017 9:07 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Could be a duplicate of this post:
viewtopic.php?p=10633#p10633

The file was updated and the second %%EOF replaces the previous one. By removing the last %%EOF you bypass the changes that have been made.

In the other thread, object 17 is incomplete and an error is thrown when object 18 starts too early.
So with your file there could be an issue with object 283 (or whichever object precedes object 284).

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 134 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