PDF guides

Count live indirect PDF objects without counting free slots

·

Use the current cross-reference entries to count live indirect objects after incremental saves. Check which counts describe storage and which describe parsed PDF syntax.

PDF Object Count

Compare the live and parsed totals

Select Load example and Count PDF objects. The fixture has ten declared live objects and all ten parse. Nine are direct and one is compressed. The two free slots, object 0 and object 8, are counted separately.

The primitive breakdown contains six dictionaries and four streams. The page reports one font and one image resource. Those page resource numbers describe declared references, independent of the file-wide object total.

Download the one-page PDF revision fixtureAdobe PDF 32000-1 reference for indirect objects and object streams

Find the stream container and its compressed object

Enter ObjStm in Filter object inventory to locate object 9. Its storage is Direct and its primitive kind is Stream. Object 10 is stored in object 9 and appears as Compressed, with primitive kind Dictionary.

Object 8 stays in the older revision’s bytes. The newer free entry supersedes it, so it disappears from the current inventory.

Find the stream container and its compressed object
ObjectCurrent storageRole
8FreeRetired in the latest update
9DirectObject-stream container
10CompressedInformation dictionary
11DirectCross-reference stream

Download the one-page PDF revision fixtureAdobe PDF 32000-1 reference for indirect objects and object streamsQPDF documentation for object and cross-reference streams

Verify the saved object inventory

Download pdf-objects-report.json. Check declaredLive and parsed are 10 and compressed is 1. Confirm the inventory holds object 10 but omits 8. A gap between declared and parsed totals means the evidence is incomplete.

Open PDF XREF Viewer to compare the latest entry for a missing object with its earlier revisions.

Download the one-page PDF revision fixtureQPDF documentation for object and cross-reference streams

Common questions

Do directly nested dictionaries count as extra indirect objects?

The total counts entries that have their own current object number. Directly nested values are part of the object that contains them.

Are page resource counts the same as the number of distinct objects?

A resource can be referenced more than once. The object inventory counts each live indirect object once.

Sources

Put it into practice.

Related guides