Copy link to clipboard
Copied
Hi
A client asks me to programmatically check the presence of "header" "body" and "trailer" in PDF batches. After examining the documentation (PDF Reference among others) I understood that the "header" is the first line:
% PDF-1.6
And that its presence is mandatory for the document to be identified as a PDF.
I understood that the "trailer" is identified by a keyword if it exists, but I did not understand why sometimes it exists and sometimes not.
Could someone explain or give me some links?
I did not understand how to identify the "body" which does not use a keyword or precise location.
Could someone explain or give me some links?
Thank you
Copy link to clipboard
Copied
I would ask the client what they mean directly instead of trying to figure it out... Many people use terms they don't really understand or have borrowed from other fields.
Copy link to clipboard
Copied
Thank you
Unfortunately it's take it or leave it.
The specifications are precise and that is part of it.
I cannot ask for details or ask a question.
Copy link to clipboard
Copied
Probably not what you want to hear, but I came to the conclusion some time ago that it's better to give up on a project that's badly defined, rather than try to make it work. You just end up with a) a dissatisfied customer, and b) a lot more work than what you had anticipated, in the long run. Unless they can provide an exact description of what they want to achieve, it's usually not worth the trouble.
Copy link to clipboard
Copied
I will try to do without, especially since there is another request which is inconsistent (about caracters encoding).
Thank you
Copy link to clipboard
Copied
After extensive research online I came to understand that "header", "trailer" and "body" are mandatory in all cases.
The thing is that since PDF 1.5 the presence of the keyword "trailer" is no longer mandatory because the "trailer" can be encoded in a "stream".
So the first answer was the correct one: these people don't really understand what they are asking.
😉
Copy link to clipboard
Copied
And let me guess, they didn't pay you for the time you spent investigating it, right?
Copy link to clipboard
Copied
Of course 😉
Copy link to clipboard
Copied
Sir JR Boulay, but did you find another indication of the trailer in the stream? so maybe another string or something else what you could use to find the trailer in an arbitrary pdf file? i have the same issue right now 🙂
Copy link to clipboard
Copied
Answer is yes and no.
I didn't find exactly what I was looking for but I did find a Check in the Preflight Profiles ("Required key missing") that checks several low-level key items, including the one I was interested in. And as we can see on this capture there are others "key" checks available.
Copy link to clipboard
Copied
Thanks!!