PDF File Header and Byte Structure

A PDF begins with an ASCII version header, stores a graph of numbered objects, and ends with information that lets a reader locate the latest cross-reference data.

PDF header at the beginning of the file

25 50 44 46 2D 31 2E 37

The bytes above are ASCII %PDF-1.7. The five-character prefix %PDF- is fixed; the version digits vary. The first line terminates with a carriage return, line feed, or both.

Core PDF structures

StructureTypical tokenRole
Header%PDF-1.xDeclares the file format and header version
Indirect objectn g obj … endobjStores dictionaries, arrays, streams, pages, and other values
Streamstream … endstreamContains byte data that may use one or more filters
Cross-referencexref or XRef streamMaps object numbers to file positions or compressed locations
Trailer datatrailer or XRef dictionaryIdentifies the document catalog and related metadata
Final pointerstartxrefPoints to the latest cross-reference section or stream
End marker%%EOFMarks the end of a PDF revision

Read the file from the end

A conventional PDF trailer is followed by startxref, a decimal byte offset, and %%EOF. PDF 1.5 and later can place trailer entries inside a cross-reference stream instead of using the literal xref and trailer keywords.

Incremental updates append changed objects and a new cross-reference section rather than rewriting the whole document. A valid updated file can therefore contain several %%EOF markers; the final revision is the relevant entry point.

Practical PDF inspection checks

  • Confirm the ASCII %PDF- header and version token.
  • Search for startxref and compare its number with the target byte offset.
  • Expect streams to contain compressed or otherwise filtered bytes, not only readable text.
  • Account for incremental revisions before treating duplicate objects as corruption.
  • Use a sandboxed, format-aware parser for security-sensitive validation.

Local processing and privacy

The PDF file format workflow opens the same Bitpeek browser workspace. Selected file bytes, file names, pasted input, searches, edits, hashes, and comparison data are processed in local browser memory and are not sent to a Bitpeek server.

The static guide itself can be read without opening a file or creating an account.

Technical reference: Adobe PDF 32000-1:2008 specification.

Frequently asked questions

Is all PDF content readable as text?

No. PDF syntax contains readable tokens, but stream data is often compressed, encoded, encrypted, or binary.

Why can a PDF contain more than one %%EOF marker?

Incremental updates append a complete new revision trailer and EOF marker while preserving earlier bytes.

Does the header version always control features?

Not always. Starting with PDF 1.4, the document catalog may contain a Version entry that supersedes the header value.