Optimize document structure to shrink PDF file size
Set expectations first: this is not an image-downsampling compressor that turns a 20 MB scan into 2 MB. It does one thing: it loads the PDF with pdf-lib and saves it again using object streams (useObjectStreams), which packs the file's many small internal objects together. That can shave bytes off a loosely structured, text-based PDF from an older generator, and does close to nothing for files whose weight is images. After processing, the page shows original size, new size and the percentage change side by side so you can decide whether the result is worth downloading.
Rather than guess, I generated two samples with pdf-lib and re-saved them the same way this tool does. A 30-page text-only PDF (created with object streams switched off) went from 63,283 bytes to 31,639 bytes, roughly half; re-saving that result again changed nothing. A one-page PDF holding a single 600x600 random-noise PNG went from 1,081,646 bytes to 1,081,289 bytes, essentially unchanged. Note the first sample was set up in the most favorable way: many PDFs exported by modern software already use object streams, so your file may gain far less, or nothing. These numbers illustrate the mechanism, not what your file will do.
No. It means the file's structure was already compact, or nearly all its weight is image data, so repacking objects cannot help. Keep your original.
That needs lower image resolution or heavier image compression, which this tool does not offer. Rescan at a lower DPI, or shrink the images with a dedicated tool and rebuild the PDF.
Page content is not rewritten; only the file structure is saved again, so it should look the same. Still, flip through the result before sending it out.
Larger files use more memory and the browser may stall. Close other tabs and retry, or split the file with PDF Split first and process the parts.
The code contains no upload request. Reading, re-saving and building the download all happen in your browser with pdf-lib; nothing is sent to a server. Opening the page loads only the pdf-lib code shipped with the site; no model is downloaded.