• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Check the presence of "header" "body" and "trailer" in PDFs

Community Expert ,
Dec 03, 2021 Dec 03, 2021

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

TOPICS
Edit and convert PDFs , JavaScript

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2021 Dec 03, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2021 Dec 03, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2021 Dec 04, 2021

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2021 Dec 04, 2021

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

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.

😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

And let me guess, they didn't pay you for the time you spent investigating it, right?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2021 Dec 06, 2021

Copy link to clipboard

Copied

Of course 😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 17, 2022 Nov 17, 2022

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 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 18, 2022 Nov 18, 2022

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.

 

Capture_2211181047.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 20, 2022 Nov 20, 2022

Copy link to clipboard

Copied

LATEST

Thanks!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines