Inside a PDF: How to Inspect Objects, Streams and Dictionaries
A beginner-friendly tour of PDF internals: objects, references, the catalog, page tree and content streams, plus how to diagnose and fix a file safely.

Inside a PDF: How to Inspect Objects, Streams and Dictionaries
Most PDF problems have a precise cause hidden inside the file: a page rotation value, a missing font, a broken link target or an action that runs when the file opens. You do not need to be a programmer to look inside. This guide gives a short tour of PDF structure and shows how to read and fix files with the PDF Object Inspector.
A PDF is a set of numbered objects
Open a PDF in a text editor and you will see blocks like 5 0 obj ... endobj. Each is an indirect object with a number and a generation (almost always 0). Objects refer to each other with references written as 5 0 R. The file ends with a cross-reference table, which says where each object starts, and a trailer, which points to the most important object: the catalog.
The basic object types
- Dictionaries: key and value pairs in double angle brackets, such as
<< /Type /Page /Rotate 90 >>. - Arrays: lists in square brackets, such as
[0 0 595 842]for an A4 page box. - Names: words starting with a slash, such as
/Helvetica. - Strings: text in parentheses or hex in angle brackets.
- Numbers, booleans and null.
- Streams: a dictionary followed by binary data, used for page content, images, fonts and metadata. The data is usually compressed.
The main structure
From the catalog, everything else can be reached:
- Catalog: points to the page tree, the outline (bookmarks), forms, metadata and actions.
- Page tree: groups pages, which can inherit settings such as resources and page size.
- Pages: each page has a MediaBox (size), optional CropBox, Rotate, Resources (fonts, images, graphics states) and Contents (the drawing instructions).
- Content streams: sequences of operators like
BT /F1 12 Tf (Hello) Tj ET, which means begin text, use font F1 at 12 points, show "Hello", end text.
Diagnosing common problems
A page opens sideways. Find the page object and check /Rotate. A value of 90 or 270 rotates it.
Wrong page size when printing. Compare /MediaBox and /CropBox. A CropBox much smaller than the MediaBox makes some printers scale strangely.
Something happens when the file opens. Look for /OpenAction or /AA in the catalog. They can jump to a page, set the zoom or, more rarely, run JavaScript.
A large file. Sort the object table by stream size; images and embedded fonts are usually the biggest.
Text extraction gives gibberish. Check the font dictionaries for a /ToUnicode entry; without it, readers cannot map glyphs back to letters.
Making a careful edit
The inspector lets you set or delete one key in one object. Values use PDF syntax: /Name, (text), numbers, true, false, null, arrays and references. Common safe edits:
- set
Rotateto0on a sideways page; - delete
OpenActionfrom the catalog; - change
Titlein the information dictionary.
Always keep the original and test the edited file in two different readers.
Example
A supplier's catalogue opens sideways in every reader. In the object table, page objects carry /Rotate 90. Setting Rotate to 0 on the first page fixes that page; doing the same on the page tree node fixes pages that inherit it.
Reading a content stream
Content streams look cryptic at first but follow a simple pattern: numbers and names come first, then a short operator. q and Q save and restore the graphics state, cm changes the coordinate system, re f fills a rectangle, Do draws an image or form, and text sits between BT and ET. Reading a page's stream is the fastest way to understand why something appears where it does, or why a white box covers part of the page.
Limits and privacy
Encrypted files show their streams as unreadable data until they are unlocked. Raw editing can break a file in ways that only some readers notice, so do not use it on legal or official documents. Everything is parsed in your browser, so the file is not uploaded.


&c=%23b45309&k=from-pdf)
