What this tool does — and what it does not
This tool loads a PDF and re-saves it in a clean, compacted form: unused objects left behind by earlier edits are dropped, the file structure is rewritten from scratch, and the object tables are stored in compressed object streams. For PDFs that have been through many rounds of editing, or were produced by generators that write sloppy structure, the result is a smaller, tidier file that opens faster. It does not recompress images, subset fonts or change page content — so a file that is large because of its images will stay large; use Compress PDF for that. And it does not produce a linearized (“fast web view”) file; see below for what that means and how to get one.
Where the savings come from
| Source of bloat | Removed? | Typical saving |
|---|---|---|
| Orphaned objects from deleted pages or edits | Yes | Anything from 0 to 50%+ on heavily edited files |
| Incremental update sections (old versions appended on each save) | Yes | Files saved many times in Acrobat can be halved |
| Uncompressed cross-reference tables | Yes — moved into object streams | A few KB to a few hundred KB |
| Redundant whitespace and verbose object syntax | Yes | Small |
| Large images | No | Use Compress PDF |
| Fully embedded fonts | No | Re-export with font subsetting |
A freshly exported document from Word or a browser usually gains little — it is already clean. A contract that has been signed, annotated and re-saved a dozen times is where this tool shines, because every save appended a new section instead of rewriting the file.
Incremental updates: why edited PDFs grow
When Acrobat and many other editors save changes, they append the modified objects and a new cross-reference table to the end of the file rather than rewriting it. That is fast and preserves signatures, but the old objects stay in place. After ten saves the file can contain ten versions of a page. Re-saving from scratch keeps only the current version of each object — which is exactly what this tool does. It also means the file's edit history is gone, which is often what you want before sharing.
About linearization (fast web view)
A linearized PDF is arranged so the first page's objects come first in the file with a hint table, letting a browser display page one while the rest is still downloading. It matters for large PDFs served over slow connections; for files under a few megabytes on modern connections the difference is negligible. Linearization requires a specialised writer — pdf-lib, the library used here, does not do it. If you need it, run the compacted file through qpdf --linearize, Ghostscript, or Acrobat's “Save As Optimized” with Fast Web View enabled.
Common uses
- Shrinking a much-edited document before emailing or archiving.
- Removing the history of previous versions from a file before it leaves the organisation.
- Repairing files with damaged cross-reference tables that some viewers refuse to open — a clean rewrite often fixes them.
- Normalising PDFs from many sources into a consistent structure before further processing.
What is preserved
- All pages, content, fonts, images and vectors, byte-for-byte.
- Annotations, form fields and links.
- Document metadata.
- Not preserved: digital signatures — rewriting the file invalidates them by design, since a signature covers the exact bytes. Keep the signed original.