Heavy compress
Basic compress stays in the browser. This page uploads the PDF and downsamples photos to about 150 DPI. The text stays text.
This file will be uploaded and deleted after 30 minutes.
Heavy compress needs a $6 day pass or the $60 year. The free file is PDF to Word, not this page.
What this downsample keeps
Heavy compress runs Ghostscript on the server. The argv is gs, -sDEVICE=pdfwrite, -dCompatibilityLevel=1.4, -dPDFSETTINGS=/ebook, -dCompressPages=false, -dNOPAUSE, -dQUIET, and -dBATCH. The /ebook preset averages color images toward 150 DPI and gray images toward 150 DPI. Resampling starts above 1.5 times the target, so a color or gray photo above 225 DPI is resampled. Mono images use Subsample toward 300 DPI. Color and gray are encoded with DCTEncode, which is JPEG. Mono uses CCITT. The preset sets ColorConversionStrategy to sRGB. -dCompressPages=false comes after the preset, so page streams are not flate-compressed and selectable text stays selectable. A text-only PDF can grow. The file this command writes begins with %PDF-1.4. The download name is always compressed.pdf.
The PDF and compressed.pdf go into MongoDB GridFS, bucket uploads, tool heavy-compress. Role source keeps the original file name, or upload.pdf when the upload has no name. Role result is named compressed.pdf. Ghostscript writes input.pdf and output.pdf in a temporary directory, then removes that directory when the job finishes or fails. Retention deletes GridFS objects whose upload time is at least RETENTION_MINUTES old. Missing, zero, or non-positive values use 30. The deletions row stores the file id, filename, tool, role, upload time, and delete time, not the bytes. The jobs row stays, with kind heavy-compress, tier pass, the page count, the checkout email, both file ids. The jobs row has no status field.
There is no free file on this page. An email and an active purchase are required before Ghostscript runs. The cap is 20 pages even when a pass is active. A day pass is $6, charged once, for 24 hours, and it does not renew. A year is $60 and runs 365 days. The email must match a purchase whose status is active, from its start up to but not including its end. The free server file is PDF to Word, one file, up to 20 pages, on its own page. Ghostscript is killed with SIGKILL after 60 seconds.
An empty form, bytes without %PDF- in the first 1024 characters, or a file whose page count cannot be read, fails with "Choose a PDF." No pages fails with "This PDF has no pages." More than 20 pages fails with "This tool compresses up to 20 pages." A missing or inactive pass fails with "Heavy compress needs a $6 day pass or the $60 year. The free file is PDF to Word, not this page." If gs is missing, the 60 second timer fires, gs exits nonzero, or the output is empty or lacks %PDF-, the page says "Heavy compress is not available on this server." That sentence stays English on every locale. A missing database refuses the upload before the bytes are classified.
Questions
Does every photo get smaller?
No. Color and gray images above 225 DPI are averaged toward 150 DPI. A smaller picture can pass through because PassThroughJPEGImages stays on. Mono images are subsampled toward 300 DPI. Selectable text is not rasterized, and a text-only PDF can grow.
Is the first upload free?
No. This page is never the free server file. The free file is one PDF to Word conversion, up to 20 pages, when that PDF has selectable text. The form asks for the checkout email of an active pass before gs runs.
What remains after the files are deleted?
GridFS removes the PDF and compressed.pdf after the retention clock, 30 minutes unless RETENTION_MINUTES is a positive number. The deletions row keeps ids and times, not bytes. The jobs row keeps the page count, the typed email and the file ids. Retention does not remove that jobs row.
What does a pass change here?
An active pass is required before the first file. The day pass is $6, charged once, for 24 hours, and it does not renew. The year is $60 for 365 days. Cancel stops the next year charge. The year already paid keeps working until its end date and is not refunded. The 20-page cap remains for a pass.