According to the QPDF source I was reading it had this quote about pdfs:
// PDF spec says %%EOF must be found within the last 1024 bytes of
// the file. We add an extra 30 characters to leave room for the
// startxref stuff.
However, I cannot find any information regarding this in the PDF 1.7 specification. I found a couple places on the internet that also mentioned this though.
My question is: is this true and if so, where is this specified that %%EOF will be in the last 1024 bytes?
The source code does indeed say that, in
libqpdf/QPDF.cc, but ISO 32000-1:2008 (the PDF 1.7 one) has this to say about the file trailer:So, if you’re following the standard, it’s even more restrictive than you state.
Back in the Adobe 1.3 specification, in Appendix H (Implementation notes), you’ll find this little snippet about the properties of the Acrobat viewer (not the file format):
In other words, it’s saying that the viewer (Adobe’s implementation) is a little more relaxed in what it will accept. The specification itself, however, still maintains that the
%%EOFhas to be on its own, on the last line.That note still exists in Adobe’s version of the file format document up to 1.7. However, it was removed from the ISO version since, rightly so, ISO don’t care one little bit about specific implementations of a product, as long as they conform to the standard as written.
Adobe’s documents can be found here, they also have the right to distribute a (slightly modified) version of the ISO 32000 standard here.