Best practices for compressing PDFs without losing quality
4/24/2026

Best practices for compressing PDFs without losing quality

Cross‑platform .NET strategies for PDF conversion and API‑based compression: cut file size hard without letting text, diagrams or scans degrade.

Follow a clear workflow: pre‑process your assets, select the proper compression algorithm, then double‑check the results. You’ll see file sizes drop dramatically while the visual fidelity stays spot‑on—perfect for contracts, e‑books, or any professional document.

Whether you’re a developer building a PDF‑heavy SaaS, a designer polishing client deliverables, or an office manager juggling a mountain of reports, these tips will keep your PDFs lean and crisp.


Understanding PDF Compression: Lossless vs. Lossy Techniques for Cross‑Platform .NET Solutions

PDFs are more than just pages of text. They can hold vectors, raster images, fonts, annotations, and more. How those pieces are stored decides how big the file gets.

  • Lossless compression leaves the original data untouched. It’s the go‑to for text, vectors, and images that must stay pixel‑perfect—think medical scans or architectural drawings. ZIP, Flate, and LZW fall into this camp.
  • Lossy compression throws away a bit of data to shave off more size. JPEG and JPEG2000 are common lossy choices for photos where a tiny quality dip is acceptable.

Start by taking inventory of what’s inside your PDF:

Asset typeRecommended compressionWhy
Text & vector graphicsLossless (Flate/ZIP)No visual degradation; vector shapes stay crisp.
High‑resolution photographsLossy (JPEG, quality 70‑85%)Human eye tolerates minor loss; size drops dramatically.
Scanned documents (black‑white)Lossless CCITT Group 4, or lossy JPEG for greyscale scansCCITT is built for bitonal pages and is usually far smaller than JPEG on the same scan.
Embedded fontsSubsettingOnly the glyphs used are kept, shaving off unused data.

A common mistake is slapping a blanket lossy setting on every image. That can make charts blurry and text unreadable. Instead, go through the pages: keep logos, diagrams and UI screenshots lossless; compress photographs more aggressively. Some PDF libraries will detect image types and pick an algorithm per image, which is worth looking for when you are choosing one.

A word on what this site is, since you may have arrived here from it: Doconut.app is a viewer. It opens a PDF so you can read it; it does not compress, convert or rewrite one. Everything below is about the tools that do.

Optimize Images Before Embedding – The Secret to Quality‑First Compression

Images are usually the bulk of a PDF's weight — measure your own file before you tune anything else. If you treat them right before they ever touch the PDF, you control both quality and size.

  1. Resize to the final display dimensions
    If a picture will appear at 800 × 600 px, there is no point embedding a 3000 × 2000 px source. That source carries roughly twelve times the pixels anyone will ever see, and resizing to the display dimensions is normally the single largest saving available.

  2. Pick the right color space

    • RGB for on‑screen PDFs.
  3. Apply suitable compression settings

    • Photographs: JPEG quality 70‑85 % keeps sharpness while trimming size.
  4. Strip unnecessary metadata
    EXIF, XMP, and thumbnail data are just dead weight. Most PDF libraries let you discard this metadata automatically.

Font subsetting, and where the megabytes actually go

Fonts are the silent culprits behind many megabyte PDFs. Embedding a full font (often 500 KB‑2 MB) drags along every glyph, even the ones you never use. Font subsetting trims that down to only the characters that actually appear.

  • How subsetting works – The PDF generator scans the document, builds a glyph list, and writes a custom subset TTF/OTF stream. That subset can be just a few kilobytes for a short report.

  • When to subset –

    • Standard fonts (Helvetica, Times, Courier) are already on most viewers; you can skip embedding altogether.
    • Custom or brand fonts should always be subset unless you need the full character set for future edits.
  • Avoid duplicate font embeddings – If the same font appears in multiple sections, make sure the PDF engine re‑uses the same subset object instead of creating separate copies.

On a document using two or three brand fonts, subsetting is often the difference between a file that attaches to an email and one that bounces — and the reader cannot tell which one they were sent.

Use Smart PDF Compression Tools with API Access

Desktop tools work fine for the occasional file, but when you need to process dozens or hundreds a day, automation is key. An API‑first, cross‑platform solution gives you:

  • Consistency – The same compression parameters everywhere.
  • Speed – Parallel processing on cloud or on‑prem servers.
  • Security – No need to upload sensitive PDFs to third‑party sites; everything runs inside your trusted environment.

Why an API matters

  1. Programmatic control – Set image quality, toggle font subsetting, pick the algorithm per asset type, and pull the compressed file back in a single HTTP call.
  2. Batch handling – Some services accept an archive of files and return an archive of results, which is worth checking for if you process documents in runs rather than one at a time.
  3. CI/CD integration – Slip compression into your build steps for documentation generation so every release ships lean PDFs.

Where Doconut sits, and where it does not

Be clear about the boundary before you plan around it. The Doconut SDK is a .NET component for rendering and converting documents inside your own application: its Converter plugin writes Word, Excel, HTML and the rest out as PDF, and the viewer draws them. Compression is not one of its jobs — there is no compression API, no quality slider and no font-subsetting switch — so if shrinking an existing PDF is the task, reach for a tool built for that.

What conversion does give you is a lever on the input. A PDF generated straight from the source document, with fonts subset at the point of writing, starts smaller than the same document printed to PDF and squeezed afterwards, and it keeps a real text layer instead of a picture of one.

And if you only need to look inside the file to see what is making it heavy, Doconut.app opens PDFs up to 25 MB in the browser, free, and deletes them when you close the tab.