Compress PDF Guide: Choose Smaller Files and Preserve Useful Content
Admin ·
Compress PDF processes one document on your device and compares each candidate with the original. Start with Balanced to optimize supported JPEG images while keeping the PDF’s text and vector content, or choose Preserve quality to repack objects without re-encoding image pixels. Use Image-only only when a rebuilt page image suits the document.
A size target is a ceiling to try to meet, rather than an exact file length or a guarantee of success. If the original already meets an enabled target, or no candidate is smaller, the tool returns its original bytes. Keep that original, inspect the downloaded result and choose settings around the features you actually need.
Choose the mode around the document’s purpose
A scanned application, a searchable report and an interactive form have different priorities. Balanced and Preserve quality keep PDF structure rather than flattening every page. They are useful starting points when selectable text, vectors or form content matters, although you still need to check the particular document’s features.
Image-only renders pages into JPEGs and builds a new PDF. A rebuilt output loses selectable text, links, form fields, accessibility tags, bookmarks and attachments. If the result instead says Original returned unchanged, none of that rebuilding happened: the original’s properties remain.
| Mode | What it tries | What to review |
|---|---|---|
| Balanced | Repack objects, optionally share identical images and optimize eligible JPEGs. | Fine image detail, text and any document features you depend on. |
| Preserve quality | Repack objects and optionally share identical image data without re-encoding pixels. | Actual savings and the original document’s forms, links and appearance. |
| Image-only | Render every page, optionally grayscale it and encode page JPEGs. | Readability and whether losing interactive or searchable content is acceptable. |
pdf-lib: document loading and savingPDF.js: document and rendering API options
Use a preset as a starting point, not a quality promise
The default is Balanced mode with JPEG quality 75, an 1800-pixel longest image side, identical-image sharing on, grayscale off and no size target. The quality number is an encoder setting. It is neither the percentage of detail preserved nor the percentage by which the PDF will shrink.
Higher quality and Smaller file change the selected JPEG quality and longest-side setting. Preserve quality switches to structural repacking. Applying a preset retains an existing size target but resets other options to the preset defaults; inspect them before rerunning. Any settings change removes the previous result.
| Preset | JPEG quality setting | Longest image side |
|---|---|---|
| Higher quality | 85 | 2400 pixels |
| Balanced | 75 | 1800 pixels |
| Smaller file | 50 | 900 pixels |
| Preserve quality | No JPEG re-encoding | Original image dimensions |
Canvas JPEG encoding parameters and failuresOffscreenCanvas JPEG encoding parameters
Compress, inspect and keep the original available
Choose or drop one PDF. A multi-file drop is not a compression batch. Select the mode, adjust useful options and start Compress PDF. Controls are disabled during processing; cancellation is available while the job runs. Clear file removes the selected document and result while your settings can remain.
The result shows original and actual output sizes, the page count and any target outcome. A smaller candidate is named with a -compressed.pdf ending; an unchanged original uses -original.pdf. When a smaller result exists, you can download the original separately. A download creates a file; the tool does not replace your source on disk.
- Keep an untouched original until the downloaded PDF passes your checks.
- Open the downloaded result in the reader or upload workflow that will actually use it.
- Check small text, images, page order and any required forms or links before discarding the source.
Understand why some images change and others do not
Balanced can downscale and re-encode eligible 8-bit RGB JPEG image streams. It uses the selected longest-side cap without upscaling small images, then replaces an image only when the newly encoded JPEG is smaller. Documents containing supported JPEGs can shrink substantially; a text-heavy PDF or a scan with other encodings may behave differently.
Eligibility is conservative. PNG/Flate images, grayscale or CMYK JPEGs, masks, special decoding settings and other unsupported image configurations are retained. A document declaring output intents also bypasses this JPEG optimization. Retained images are not secretly removed or counted as successfully optimized. Image limits can cause additional skipping.
pdf-lib: document loading and savingOffscreenCanvas JPEG encoding parameters
Share identical data without treating similar pictures as duplicates
Share identical embedded images is enabled by default in the preserving modes. It can reuse repeated encoded image streams, including compatible masks, without decoding or re-encoding their pixels. The encoded bytes and supported dictionary settings must match; two pictures that merely look alike are not enough.
The analysis also accounts for references and resource-dependent colors. Unsupported identity metadata, unsafe uses or complexity limits may keep images separate. You can disable sharing if needed. Sharing itself preserves encoded pixels; Balanced may subsequently perform its separately selected JPEG optimization.
Treat a target as a maximum byte count to try to reach
Enable Try to meet a file-size target and enter a value in decimal KB. Here 1 KB means 1000 bytes and 1000 KB means 1 MB; use 100 KB for a 100000-byte ceiling. Targets range from 1 to 50000 KB. The reported actual byte count and Target met or Target not reached outcome matter more than an approximate size display.
Balanced first tries preserving repacking, then up to six distinct JPEG quality settings descending from your selected value to 20. At the default 75, those possible JPEG settings are 75, 64, 53, 42, 31 and 20. Each attempt rereads the original; dimensions, page resolution and grayscale stay at your chosen settings. The search stops once a tested candidate meets the ceiling, otherwise retaining the smallest tested result or original.
| Selected mode | Maximum candidate attempts | Important early return |
|---|---|---|
| Balanced | 7: one preserving pass plus up to 6 JPEG settings. | An already-small valid original is returned with 0 attempts. |
| Preserve quality | 1 preserving candidate. | No JPEG-quality search is performed. |
| Image-only | Up to 6 distinct JPEG settings after acknowledgement. | An already-small valid original is returned unchanged; the 50-page source limit still applies. |
Choose selective grayscale or whole rendered-page grayscale
In Balanced, grayscale applies only to eligible JPEGs that are actually replaced with smaller encoded streams. Colored text, vectors and retained images keep their source colors. This can leave a document partly colored; it is not a whole-PDF black-and-white conversion.
In Image-only, grayscale changes each rendered page before JPEG encoding, so a rebuilt result includes the visible page content in grayscale. Preserve quality does not perform that transformation. An unchanged-original result keeps the original colors even if grayscale was selected.
Accept the losses before rebuilding page images
Image-only needs explicit acknowledgement and supports at most 50 source pages. Its resolution choices are 72, 96, 120 and 150 PPI; the default is 96. Higher resolution can improve the visibility of small print while increasing image work and size. JPEG quality remains adjustable from 20 to 95. Rendering uses a white background.
New pages use the rendered page dimensions rather than reconstructing editable source objects. Text and visible form appearances can become pixels, while interactive fields and document navigation structures are not copied. No OCR is added. A low-resolution result can look acceptable as a thumbnail yet fail at reading size. If the rebuilt candidate is not smaller, the returned original is unchanged instead.
PDF.js: document and rendering API optionsCanvas JPEG encoding parameters and failures
Recognize the input and rendering limits
The whole source must be nonempty, no larger than 50000000 bytes and contain 1 to 300 pages. Preserving modes can process that page range; Image-only additionally limits the source to 50 pages. This workspace has no page-range selector. Split a suitable unsigned document first if you need a smaller source rather than expecting a target to bypass its limits.
Rendering and image optimization have separate budgets. A source that fits the file-size limit may still exceed image or page-pixel limits. Lowering raster PPI may help with rendered-page limits, but does not remove the separate oversized embedded-image guard. These bounds constrain processing; they do not promise successful conversion of every document within them.
| Scope | Bound | What it means |
|---|---|---|
| Source file | 1–50000000 bytes | The whole chosen PDF, not a selected subset. |
| Source pages | 1–300; Image-only at most 50 | An enabled target does not bypass these source limits. |
| Balanced JPEG candidate | 24000000 pixels; 12000 pixels per edge; 25000000 encoded bytes | Oversized or otherwise ineligible images are retained. |
| Balanced pixel accounting | 150000000 pixels per candidate pass | Attempts can stop optimizing further eligible images after this accounting budget. |
| Raster page | 12000000 pixels and 8192 pixels per edge | The rendered dimensions depend on the selected PPI. |
| Raster pixel accounting | 150000000 rendered pixels per candidate pass | The total covers pages within that candidate. |
| Raster JPEG payload | 50000000 accumulated JPEG bytes per candidate | A payload guard, not a separate serialized-PDF byte test. |
| Deadlines | 60 seconds for preserving jobs; 120 seconds for Image-only | The complete target search shares its mode’s job deadline. |
Compression does not validate every PDF feature or remove private data
Keeping PDF structure is different from certifying all advanced features. Reopen the downloaded file and test needed forms, links, fonts, bookmarks and reading order. Preserve quality avoids image re-encoding but is not a byte-identical operation; repacking and image sharing can change the file’s object organization.
Compression is not a redaction or metadata-sanitization tool. Preserving modes can keep document metadata and other source content. A rebuilt PDF does not copy original metadata into its new document, but an unchanged-original return still carries the original data. Do not use a smaller file or a new filename as proof that hidden or sensitive information was removed.
Use the comparison for visible checks, then test the downloaded file
Compare original and result opens local rendered page views. Preview detail choices of 800, 1600 and 2400 pixels change that visual inspection, not the compression settings or file-size target. Look at small print, photographs, diagrams and colored content on corresponding pages.
A preview is not a test of interactive form behavior, live links, accessibility tags or every font and pixel. Preview failure is also separate from compression: you may need to inspect the downloaded file in another reader. In a rebuilt Image-only result, visible text can look intact even though search and text selection are gone.
Work out why the file stayed large or was rejected
Original returned unchanged means the candidate was equal in size or larger, or the original already met the enabled target. Already-efficient object streams and unsupported image encodings can limit savings. Try a more suitable mode or smaller image settings, or improve the source export. A tiny target may be impractical without losing readability.
Invalid headers, unreadable or encrypted files, and detected signature fields are refused. Use a valid unsigned, unencrypted copy that you are entitled to edit; the tool does not unlock, repair or preserve digital signatures. For rendering limits or timeouts, try a lower resolution or a smaller source. Repeating identical settings is not a promise that a failed document will succeed.
Cancel safely and make a deliberate retry
Cancel terminates a preserving worker or aborts the Image-only rendering path. A partial attempt is not offered as completed output. Your source file remains unchanged, and you can retry with settings that better suit its size and complexity. A timeout similarly ends the job rather than guaranteeing a partial result.
Changing a mode, target or other setting invalidates the old result so the next download corresponds to a fresh run. Selecting another file clears the previous output and error. Check the selected preset after a retry; applying one can reset custom grayscale or mode choices while keeping the target.
Understand local processing and resource loading
PDF parsing, image processing and downloads use the chosen bytes on your device. Preserving jobs run in a local worker; Image-only uses the local PDF renderer and canvas encoding. The site’s renderer code, fonts and codecs still load as normal site resources. Document processing locality does not mean the whole website or browser makes no other network requests.
Keep the source available and handle downloaded copies according to your needs. Local conversion is useful when you want to avoid a document upload, but neither locality nor compression replaces a review of the PDF’s contents and the requirements of the recipient.
Worker termination behaviorPDF.js: document and rendering API options
Check the result against the job it must do
For a searchable report, confirm text selection and inspect image detail. For a form, test the fields and links you need. For a strict upload ceiling, check the reported bytes and the actual downloaded file size. Keep a preserving result when those features matter; accept rebuilt pages only when the file’s purpose allows their losses.
- Keep the original and compare the candidate at a useful reading size.
- Use the actual target outcome; do not assume an exact size or guaranteed saving.
- Return to the source export or split the document when the required quality and ceiling cannot both be met.
Common questions
How does PDF compression work?
This tool can repack PDF objects, optionally share identical encoded images, optimize eligible JPEGs or rebuild every page as an image. The selected mode determines the changes. The candidate is compared with the original, and an equal or larger candidate is replaced by the unchanged source bytes.
Why did my PDF not get smaller?
It may already be efficiently packed or contain images that Balanced leaves unchanged. A new serialization can also add overhead. Original returned unchanged is an explicit result, not a claim of successful reduction. Try suitable settings or a better source export while keeping readability.
Can I compress a PDF to exactly 100 KB?
You can request a 100 KB ceiling, meaning 100000 bytes, but an exact file length and successful reduction are not guaranteed. The result reports the actual bytes and whether the ceiling was met; if missed, it retains the smallest tested candidate or original.
Will compressed PDF text remain selectable?
Balanced and Preserve quality retain PDF text content rather than flattening pages, although you should test your document. A rebuilt Image-only output has no selectable text or OCR layer. If that mode returns the original unchanged, its original properties remain.
Which PDF images can Balanced mode optimize?
It targets eligible 8-bit DeviceRGB JPEG streams without excluded masks, decoding settings or special image configurations. Output intents, other encodings and size limits can cause images to be retained. Even an eligible JPEG is replaced only when its new stream is smaller.
Does grayscale change every PDF page?
Balanced grayscale changes only optimized JPEGs that are actually replaced; text, vectors and retained images keep their colors. A rebuilt Image-only result grayscales whole rendered pages. Preserve quality and unchanged-original returns do not apply that transformation.
Why are signed or encrypted PDFs rejected?
The tool cannot unlock encrypted documents and conservatively refuses detected signature fields or markers rather than rewrite them. Compression can invalidate signatures. Use a valid unsigned, unencrypted copy when appropriate; this is not cryptographic signature validation.
How many compression attempts can a size target use?
Balanced can try one preserving pass plus up to six distinct descending JPEG qualities, at most seven candidates. Preserve quality tries one candidate and Image-only up to six. A valid original already within the target is returned with zero attempts; mode-specific source limits still apply.
What happens when I cancel PDF compression?
The local worker is terminated or the raster rendering path is aborted. Partial output is not presented as a finished result, and the original file is unchanged. You can retry with smaller input or different settings.
Does sharing identical images lower image quality?
Sharing compares encoded bytes and compatible image settings without re-encoding pixels. Similar-looking images are not enough, and unsupported identity or reference uses can prevent sharing. Balanced may separately optimize eligible JPEGs afterward.
How many pages can I compress?
Preserving modes accept a whole PDF with 1 to 300 pages; Image-only accepts at most 50. The file must fit the source byte limit and other processing guards. There is no page-range control in this workspace; split a suitable source first if needed.
Does Preserve quality remove metadata or certify PDF features?
No. It avoids re-encoding image pixels, but repacking is not byte identity, metadata sanitization or validation of every form, link, font or accessibility feature. Retain the original and check the downloaded result for the features you depend on.
Can Image-only return a searchable original instead of rebuilt pages?
Yes. If the original already meets an enabled target or no rebuilt candidate is smaller, the original bytes are returned unchanged. Read the result label. Loss of text and interactive features applies to a rebuilt output, not to an unchanged original.
Does my PDF get uploaded?
These compression paths process the chosen document bytes locally and create local downloads. Renderer code, fonts and codecs still load from the site. Local document processing is distinct from a claim that the entire website or browser sends no other requests.