Private browser-based PDF compressor with Lossless, Balanced and Maximum compression modes.
Built and maintained by ClearHowGuide.
Official live version:
https://clearhowguide.com/en/tools/pdf-compressor/
Full guide:
https://clearhowguide.com/en/files/compress-pdf-without-losing-quality/
The ClearHowGuide Private PDF Compressor analyzes and compresses PDF files directly in the browser.
The current version provides three compression modes.
Uses the ClearHowGuide Go/WebAssembly engine powered by pdfcpu.
Designed to:
- preserve the original PDF structure;
- avoid intentional image-quality reduction;
- optimize PDF objects and resources;
- validate the generated PDF;
- preserve selectable text, links and interactive structure where supported.
Lossless compression may produce only a small reduction when the source PDF is already optimized.
Uses browser-side page rasterization through the ClearHowGuide wise-pdf integration.
Current preset:
180 DPI
JPEG quality 82
It aims for strong file-size reduction while retaining high visual quality.
Because pages are rasterized, selectable text, links, forms, accessibility tags and other interactive PDF features may be lost.
Uses more aggressive browser-side rasterization.
Current preset:
120 DPI
JPEG quality 60
Designed for cases where reaching a smaller file size matters more than preserving original PDF structure.
Selectable text, links, forms and other interactive features are not preserved.
The current version includes:
- drag-and-drop PDF selection;
- standard file picker;
- PDF analysis before compression;
- page count;
- image/resource information;
- font/resource information;
- compression recommendation;
- Lossless Optimize mode;
- Balanced mode;
- Maximum Compression mode;
- local browser-side processing;
- Web Worker execution;
- WebAssembly lossless engine;
- cancellation support;
- elapsed-time processing indicator;
- result file-size comparison;
- percentage reduction display;
- PDF output validation;
- compressed PDF preview;
- previous/next page preview navigation;
- downloadable compressed result;
- reset and compress-again workflow;
- large-file warning;
- 200 MB current file-size limit;
- responsive layout;
- light/dark theme compatibility;
- no PDF upload to ClearHowGuide;
- no PDF upload to PocketBase;
- no PDF upload to R2;
- no remote compression server.
PDF data is processed locally in the browser.
The compressor does not need to send the selected PDF to:
- ClearHowGuide;
- PocketBase;
- Cloudflare R2;
- a compression API;
- a third-party compression server.
The component does not intentionally persist PDF contents in:
- localStorage;
- sessionStorage;
- IndexedDB;
- cookies.
See PRIVACY.md.
PdfCompressor.astro
β
βββ PDF analysis / preview
β β
β PDF.js 6.2.108
β
βββ Lossless Optimize
β β
β pdf-worker.js
β β
β wasm_exec.js
β β
β pdf-engine.wasm
β β
β Go + pdfcpu 0.15.0
β
βββ Balanced / Maximum
β
wise-pdf Web Worker
β
page rasterization
β
JPEG / PNG codecs
β
rebuilt PDF
| Mode | Engine | Current preset | Structure |
|---|---|---|---|
| Lossless | Go + pdfcpu WASM | structural optimization | best preservation |
| Balanced | wise-pdf | 180 DPI / JPEG 82 | rasterized |
| Maximum | wise-pdf | 120 DPI / JPEG 60 | rasterized |
Results depend heavily on the structure of the source PDF.
A ClearHowGuide V1 image-heavy test file:
Original:
~36.8 MB
100 pages
Balanced:
~21.0 MB
Maximum:
~8.14 MB
A smaller mixed-content test:
Original:
~1.07 MB
Lossless:
~967 KB
These examples are not guarantees. Some PDFs compress substantially; already optimized PDFs may shrink very little.
Balanced and Maximum rebuild pages as images.
They may therefore remove or change:
- selectable text;
- searchable text;
- hyperlinks;
- form fields;
- annotations;
- document structure;
- accessibility tags;
- embedded interactive content.
Use Lossless when retaining document structure matters.
Always keep the original PDF.
The project uses:
- Astro;
- browser-native JavaScript;
- Web Workers;
- WebAssembly;
- Go;
- pdfcpu 0.15.0;
- PDF.js / pdfjs-dist 6.2.108;
- ClearHowGuide's vendored wise-pdf build;
- @jsquash/jpeg;
- @jsquash/oxipng.
This repository is distributed as source code rather than as a published npm package.
Copy the component and supporting files while preserving their relative paths.
See:
Install dependencies:
npm installRun repository checks:
npm run checkGo is required.
Run:
npm run build:wasmThe script compiles:
src/wasm/pdf-compressor/main.go
into:
public/tools/pdf-compressor/pdf-engine.wasm
and copies the matching Go WebAssembly runtime:
public/tools/pdf-compressor/wasm_exec.js
Install:
npm installThen:
npm run checkOr run the checks separately:
npm run check:structure
npm run check:privacyThe structure check verifies:
- required source files;
- required runtime files;
- WebAssembly file header;
- key compressor functionality markers;
- the pinned SHA-256 of the vendored wise-pdf package.
The privacy check scans the published component and workers for browser-storage, network-upload and analytics-input patterns.
pdf-compressor/
βββ .github/
β βββ ISSUE_TEMPLATE/
β β βββ bug_report.yml
β β βββ feature_request.yml
β βββ pull_request_template.md
βββ examples/
β βββ basic-usage.mdx
β βββ hosted-embed.html
βββ public/
β βββ tools/
β βββ pdf-compressor/
β βββ pdf-engine.wasm
β βββ pdf-worker.js
β βββ wasm_exec.js
βββ scripts/
β βββ build-pdf-compressor-wasm.sh
β βββ check-structure.mjs
β βββ privacy-check.mjs
βββ src/
β βββ components/
β β βββ tools/
β β βββ PdfCompressor.astro
β βββ wasm/
β β βββ pdf-compressor/
β β βββ main.go
β β βββ go.mod
β β βββ go.sum
β βββ workers/
β βββ wise-pdf.worker.js
βββ vendor/
β βββ wise-pdf/
β βββ ecgear-wise-pdf-0.1.0-clearhowguide.1.tgz
β βββ CLEARHOWGUIDE_PATCH.diff
β βββ LICENSE
β βββ NOTICE
β βββ PROVENANCE.md
βββ EMBEDDING.md
βββ CHANGELOG.md
βββ CITATION.cff
βββ CODE_OF_CONDUCT.md
βββ CONTRIBUTING.md
βββ LICENSE
βββ PRIVACY.md
βββ README.md
βββ SECURITY.md
βββ SUPPORT.md
βββ THIRD_PARTY_LICENSES.md
βββ astro.config.mjs
βββ package-lock.json
βββ package.json
The hosted ClearHowGuide Private PDF Compressor can be added to websites that allow HTML iframes.
No installation, API key or backend is required.
<iframe
src="https://clearhowguide.com/en/tools/pdf-compressor/embed/"
title="ClearHowGuide Private PDF Compressor"
width="100%"
height="1100"
loading="lazy"
style="display:block;width:100%;border:0;border-radius:16px;"
></iframe>For the recommended responsive version with automatic height adjustment, see:
The hosted version remains maintained by ClearHowGuide and PDF processing remains local in the visitor's browser.
Live embed:
https://clearhowguide.com/en/tools/pdf-compressor/embed/
Contributions are welcome.
Please read:
before opening a pull request.
Do not publish security vulnerabilities or confidential PDF samples in public issues.
See:
For usage questions and bug reports:
Citation information is available in:
ClearHowGuide-authored source code is released under the MIT License.
Third-party components retain their respective licenses.
See:
ClearHowGuide:
https://clearhowguide.com/en/tools/pdf-compressor/
Guide:
https://clearhowguide.com/en/files/compress-pdf-without-losing-quality/