Compression & File Size

How Much You Can Compress a Scanned PDF Before OCR Stops Working

How Much You Can Compress a Scanned PDF Before OCR Stops Working

If you have a scanned document you both need to compress for storage or email and want to make searchable with OCR, the order you do those two things in actually matters, and doing it in the wrong order can quietly ruin your OCR results without it being obvious until you try to search the file later and nothing comes up. Compression and OCR interact in a way that is not immediately intuitive, so it is worth understanding what is actually happening before you process a batch of scans this way.

Why compression can break OCR specifically

OCR works by recognising the shapes of individual characters, which depends on crisp, clean edges between the dark text and the light background behind it. Heavy JPEG-style compression introduces exactly the kind of artifact that blurs those edges — blocky patches of slightly wrong colour clustered around high-contrast boundaries, which is precisely where every letter's edge sits. At a mild compression level this is invisible to a human eye but still degrades OCR's accuracy somewhat; push it further and individual characters start to visually merge or distort enough that the recognition engine genuinely cannot tell one letter from another, and accuracy drops sharply rather than gradually.

The order that protects both

  1. Run OCR on the scan first, while the image quality is still as close to the original scan as possible, using OCR PDF. This gives you the most accurate text recognition the scan quality allows.
  2. Compress the resulting searchable PDF afterward, if you still need a smaller file size for storage or email.
  3. Keep in mind that compressing the already-OCR'd PDF does not touch the invisible text layer itself — that text was already extracted and embedded, so further compressing the page images afterward does not undo or damage the searchability you already achieved.

Why this order matters more than it might seem

If you compress heavily first and then try to run OCR on the already-degraded image, the recognition engine is working from the damaged version and will make more mistakes — mistakes that then get permanently baked into the invisible text layer, since there is no way to fix OCR output after the fact without re-running it on a cleaner source. Doing OCR first and compressing the output afterward sidesteps this entirely: the text layer is locked in at the best accuracy your scan supports, and any later compression only affects how heavy the visible page images are, not the already-extracted text underneath them.

How much compression is actually safe before OCR

There is no single universal number, since it depends on your scan's original resolution and how heavy a compression pass you apply, but as a practical rule: if you can still comfortably read every character with your own eyes at a normal zoom level without squinting or guessing, OCR will almost always manage it too, since the recognition engine and your eyes are both relying on the same crisp character edges. Once you start needing to zoom in or guess at a blurry character yourself, OCR accuracy has likely already started dropping noticeably on that same page.

What this means if you already have a heavily compressed scan

If you are starting from a scan that has already been compressed hard — forwarded through several email hops, each one potentially re-compressing it, for instance — running OCR on it now will simply reflect whatever damage is already there; there is no way to recover detail compression has already discarded. In that situation, if a cleaner original or the original paper document is still available, re-scanning or re-exporting from that source before OCR will give meaningfully better results than trying to extract more accuracy out of an already-degraded file.

A note on PDF compression versus image compression specifically

Not all "PDF compression" tools work the same way under the hood — some recompress the embedded page images directly (the kind that can hurt OCR accuracy if done before recognition), while others mainly strip unused embedded fonts, metadata or duplicate resources, which barely affects image quality at all. If you are not sure which kind a given tool uses, the safe default is still to run OCR first regardless, since it costs you nothing to do so and removes the ambiguity entirely.

Balancing file size and searchability for archival

For documents you are archiving long-term where both a reasonable file size and searchability matter, OCR first and then a moderate compression pass afterward is usually the sweet spot — you keep the best possible text accuracy locked in, while still getting a meaningfully smaller file than the raw, uncompressed scan for storage purposes. Avoid chasing an extremely aggressive size target on the visible images if search accuracy is the main reason you are OCR'ing the document in the first place.

Frequently asked questions

Does compressing a PDF after OCR delete the searchable text?

No. The recognised text is a separate, embedded layer from the page images. Compressing the images afterward does not remove or alter that text layer.

Can I fix bad OCR results by just running OCR again on the same file?

Only if you run it on a less-compressed, cleaner version of the source. Running OCR again on the same already-degraded images will give similar or identical results.

What resolution should I scan at if OCR accuracy matters most?

Around 200 to 300 DPI is a solid general target for OCR-bound scans — high enough for accurate character recognition without producing an unnecessarily huge file.

Does this apply to photos of documents too, not just scanner output?

Yes, the same principle applies — run OCR on the clearest version of the photo you have, before any heavy compression.

Is there a page limit for OCR PDF?

Yes, currently up to 15 pages per PDF, since OCR takes real processing time per page.

What a quick before-and-after check looks like

A simple habit worth building: after running OCR, skim the extracted text against the original page for one or two lines you know are tricky — a line with numbers, or a line in a smaller font size than the rest of the page. If those specific lines came through accurately, the rest of the page almost certainly did too, since they represent the hardest case on that page rather than the easiest one.

Related guides

← Back to all posts

Keep reading