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

Token 284 was not expected in PdfReader.Open(file...
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3541
Page 1 of 1

Author:  alex999 [ Fri Feb 17, 2017 4:20 pm ]
Post subject:  Token 284 was not expected in PdfReader.Open(file...

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

Author:  Thomas Hoevel [ Mon Feb 20, 2017 9:07 am ]
Post subject:  Re: Token 284 was not expected in PdfReader.Open(file...

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).

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