PDF Shrink
PLUGINTwo tools and a bundled skill.
by Hazem-Samak · v1.0.3
What it does
Shrink a PDF to a size limit (2 MB, 500 KB, whatever the upload form says) with everything running locally — no upload, no API key, no third-party service. Two tools and a bundled skill.
pdf_inspect reports what makes a file heavy: image share of the bytes, the resolution each image is actually displayed at, fonts, embedded attachments and duplicates, with a verdict (images dominate / images not reclaimable / vector-heavy / already small) so a shrink that cannot work is caught before it runs. pdf_shrink downsamples images it can re-encode safely to the resolution they are displayed at, recovered by replaying each page's content stream (q/Q/cm/Do, including nested Form XObjects), then walks a measured ladder of DPI/JPEG-quality rungs from the mildest down and keeps the first that fits — each rung rebuilt from the pristine original, so the copy is one generation of compression rather than six.
Text, fonts and vector art are never rasterised; images that cannot be re-encoded safely (JBIG2, CCITT, 1-bit or non-8-bit samples, soft/stencil masks, /Mask, /Matte or /Decode arrays, CMYK and other print colour spaces, tiny logos) are left byte-for-byte alone. When the limit cannot be reached without making the document unreadable it stops at the safe floor, reports the smallest safe size, saves that copy when it is meaningfully smaller, and names the levers that can actually help (a reachable higher target, or aggressive=true when it can do better) instead of handing back mush.
Every copy is re-opened and verified (page count, blank pages, structural syntax) before delivery; a copy that fails is reported as failed, not as a success. The source is re-hashed before and after every completed run, and a change is reported rather than claimed untouched.
A before/after render of page 1 comes back when PDFium is available and a verified copy was written. Writes only new files; an existing output path is refused, never overwritten.
Ladder rungs are built in a private system-temp dire
Tools it adds
The tools an agent gets once this plugin is installed.
- pdf_shrink
- pdf_inspect
Review notes
What an owner reads and accepts before the install is approved.
- Ulpi has not reviewed this version: it is listed in the public plugin catalog, and the install still fetches it at its pinned commit, checks its shape and scans it before you approve