michaelrsweet / pdfio

PDFio is a simple C library for reading and writing PDF files.
https://www.msweet.org/pdfio
Apache License 2.0
198 stars 44 forks source link

PDF Trailer is not recognized: trailer<< #80

Open vlasovsoft1979 opened 16 hours ago

vlasovsoft1979 commented 16 hours ago

Description If there is no space and no new line between "trailer" keyword and "<<" than the trailer is not recognized and we have "Malformed xref table section 'trailer<<......" error

Is there requirement that the "trailer" keyword should be separated with whitespace or new line?

How to reproduce We have the following PDF trailer:

trailer<</Size 46/Info 6 0 R/Root 20 0 R
/Encrypt 7 0 R
/ID[<5dd50a1b97f588ff90b175d49afe402f><5dd50a1b97f588ff90b175d49afe402f>]
>>

No new line after the "trailer" keyword. Foxit PDF reader opens this document successfully

Expected behavior Open document successfully

vlasovsoft1979 commented 15 hours ago

I've attached a simple PDF file to demonstrate this problem trailer1.pdf