What Makes a PDF Large?
- High-resolution images without compression (most common cause).
- Full embedded fonts instead of subsets.
- Unnecessary metadata and thumbnails.
- Scanned without OCR — one high-res image per page.
Method 1: Ghostscript (Free, Best Quality Control)
sudo apt install ghostscript # Ubuntu/Debian
brew install ghostscript # macOS
# Screen quality (72 DPI) — smallest size
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/screen \
-dNOPAUSE -dBATCH -dQUIET \
-sOutputFile=compressed.pdf original.pdf
# eBook quality (150 DPI) — recommended
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/ebook \
-dNOPAUSE -dBATCH -dQUIET \
-sOutputFile=compressed.pdf original.pdf
# Print quality (300 DPI)
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/printer \
-dNOPAUSE -dBATCH -dQUIET \
-sOutputFile=compressed.pdf original.pdf
PDFSETTINGS Levels
| Level | DPI | Typical reduction |
|---|---|---|
/screen |
72 | 80-90% |
/ebook |
150 | 60-80% |
/printer |
300 | 30-50% |
/prepress |
300+ | 10-20% |
Method 2: qpdf (Structure Compression)
qpdf --compress-streams=y --object-streams=generate \
original.pdf compressed.pdf
qpdf --linearize original.pdf compressed_web.pdf
Method 3: Python with PyMuPDF
import fitz # pip install pymupdf
def compress_pdf(input_path, output_path, image_quality=60):
doc = fitz.open(input_path)
for page_num in range(len(doc)):
page = doc[page_num]
for img in page.get_images(full=True):
xref = img[0]
pix = fitz.Pixmap(doc, xref)
if pix.n >= 4:
pix = fitz.Pixmap(fitz.csRGB, pix)
doc.update_stream(xref, pix.tobytes("jpeg", jpg_quality=image_quality))
doc.save(output_path, garbage=4, deflate=True, clean=True)
doc.close()
compress_pdf("document.pdf", "compressed.pdf", image_quality=60)
Real-World Results
Test PDF: 20 pages with 15 images — original 45 MB:
| Method | Result size | Quality |
|---|---|---|
GS /screen |
2.1 MB | Good for screen |
GS /ebook |
4.8 MB | Very good |
GS /printer |
12 MB | Excellent |
| qpdf | 43 MB | Identical |
| PyMuPDF (q=60) | 8 MB | Very good |
Online Tools
- ilovepdf.com — free, up to 100 MB.
- smallpdf.com — free with limits.
- Adobe Acrobat online — free with Adobe account.
⚠️ Don't use online tools with confidential documents.
Conclusion
For everyday documents: Ghostscript /ebook reduces size 70% with excellent quality. For structure-heavy PDFs: qpdf compresses without touching content. For pipeline automation: PyMuPDF gives precise control.
Advanced Use Cases
Legal and business workflow: signed contracts are distributed in PDF/A (PDF Archival) which guarantees the document renders identically in 50 years — all fonts embedded, no JavaScript, no dynamic content. Electronic signature (PAdES, advanced eSignatures) is integrated in PDF and validates cryptographically. Academic publishing: theses and papers use LaTeX → PDF for precise mathematical formulas; journals require specific format (Word with styles, LaTeX with journal class, or both). Converting between LaTeX, DOCX and PDF preserving semantic structure (citations, references, equations) requires specialized tools like Pandoc. E-books: Amazon KDP requires MOBI (legacy) or KFX (modern) format generated from EPUB; Apple Books accepts EPUB natively; Kobo, PocketBook and Nook prefer EPUB; Google Play Books accepts PDF and EPUB. Converting DOCX manuscript to EPUB requires attention to semantic markup (hierarchical headings, lists, blockquotes) so reflowable layout works well. Translation workflows: professional translators prefer XLIFF as intermediate format — maintains segmentation, translation memory matches, and context info that is lost in plain text export.
Best Practices and Professional Tips
Style preservation: when converting between editable formats (DOCX↔ODT↔RTF), always use defined styles instead of direct formatting — Heading 1/2/3 vs "16pt Bold". This guarantees outline preservation and conversion maintains hierarchical structure. Font embedding: for cross-platform distribution (PDF), embed all non-standard fonts — without embedding, readers automatically substitute with available fonts which can break layout. PDF/A for archival: for legal, regulatory or permanent archive documents, export as PDF/A-1b (basic) or PDF/A-2u (Unicode + JPEG2000) — doesn't allow dynamic content, guarantees self-contained rendering. Revision history: PDF, DOCX and ODT support tracked changes and comments — when converting, decide if you want to preserve them (DOCX→DOCX or DOCX→ODT) or flatten them (DOCX→PDF typically accepts only the final state). Accessibility: PDF documents for public distribution should comply with PDF/UA — heading structure, alt text on images, defined reading order for screen readers.
Compatibility and Technical Considerations
KaijuConverter uses LibreOffice 7.6 headless as the main engine with Pandoc 3.x as fallback for complex markup conversions. We support more than 60 document formats (PDF, DOCX, DOC, ODT, RTF, TXT, HTML, MD, EPUB, MOBI, AZW3, FB2, LaTeX, RST and more). Format fidelity: we preserve fonts (with substitution fallback if original font is not on system), sizes, colors, complete paragraphs with indentation and line spacing, nested lists, tables with cell merging and complex borders, embedded images with anchor positioning, headers/footers with dynamic fields (page number, date, document title), footnotes and endnotes. PDF conversion: we guarantee PDF/A-conforming output when required, with correct font embedding and ICC profile embedding for absolute color fidelity. Limitations: documents with macros (DOCX with VBA) don't execute macros during conversion — only static content is preserved. Scanned PDFs (image without OCR) are not editable — they need previous OCR (Tesseract, ABBYY) to extract text. Privacy: TLS 1.3, isolated Docker containers, deletion after 2 hours. Performance: typical 20-page document takes 3-8 seconds; large documents with many images may require 15-30 seconds.
Related conversions
Document conversions that follow this topic naturally: