Rebuilding the File Instead of Repacking It
Compression begins with a full parse: expand object streams, discard unreachable objects left by incremental saves, renumber what remains, and emit a fresh cross-reference stream. Orphan objects often account for a large share of a PDF that has been edited many times, because each save appends changes instead of rewriting the file. Byte-level recompression alone cannot see this garbage.
Duplicate resources are merged by hashing stream bytes or font descriptors, so one Helvetica subset referenced by twenty pages becomes a single object. Name trees, outlines and destinations are preserved while unused JavaScript, embedded thumbnails and unreferenced page labels are dropped. The output is still a normal PDF, not a container of page screenshots.