DEV Community

yue xing
yue xing

Posted on

My scanned PDF had to be under 2 MB. The hard part was deciding which 2 MB


An application portal says "PDF only, max 2 MB". My first question was how to shrink the file. The question that actually mattered came later: which 2 MB?

I'm a CS senior, and portals with this kind of limit show up everywhere in my life right now: competitions, summer programs, internship forms. I didn't want to experiment on real documents with my personal details in them, so I generated a fake one: a fictional four-page "cooperation intent registration form", each page rendered as a 300 dpi color image with a beige background, noise and a slight tilt so it looks like a phone scan. The file is 8,948,995 bytes. The text on the pages is Chinese, which doesn't matter for anything below.

First, figure out what kind of PDF you have

A scanned PDF is just pictures of pages. There is no text layer, meaning there is no real, selectable text underneath: you can't highlight a word or find it with Ctrl+F. A PDF exported from Word or Google Docs does have a text layer. The quickest test is to search for a word you know is on the page. If search finds nothing and you can't select anything, you're holding a scan, and nearly all of its weight is image data. That's good news, because images are the part a compressor can actually shrink.

DPI is dots per inch, how many pixels are packed into each inch of paper. An A4 page at 300 dpi is 2480×3508 pixels, far more than anyone needs to read a form on screen.

Four presets, one sensible answer

I used the PDF compressor on ImgIng (https://imging.ai/), which runs in the browser. With DevTools open on the Network tab, I saw no request sending the file anywhere while it compressed and saved, which I cared about for anything carrying ID numbers. It offers four presets. Here is what my fake scan turned into:

  • Screen, 72 dpi: 347 KB. Small, and the letter edges go soft and smudgy.
  • eBook, 150 dpi: 1,927,707 bytes, shown as 1.84 MB, 78.5% smaller. Text stays crisp.
  • Print, 300 dpi: 8.46 MB. Only 0.8% smaller, since the scan was already 300 dpi and there was nothing to downsample.
  • Lossless structure: pixels untouched, size basically unchanged.

ImgIng PDF compressor with the eBook 150 dpi preset outlined in red and the result card reading

The screen preset is tempting because it's the smallest number. Zoom in and it stops looking tempting. I compared crops of the same paragraph from each result, plus macOS's built-in Quartz filter "Reduce File Size" (the one you can pick when exporting from Preview). To be exact, I ran that same system filter file directly and did not click through Preview's export dialog to double-check. It produced 2,905,274 bytes, which is still over the limit.

Detail crops of the same scanned page: original 8.53 MB, Screen 72 dpi 347 KB with soft edges, eBook 150 dpi 1.84 MB, and macOS Reduce File Size 2.77 MB (red box, still over 2 MB). Self-made fictional form; sizes use 1 MB = 1024 KB

The 2 MB question

The compressor shows 1.84 MB, but that counts 1 MB as 1,048,576 bytes. By the decimal definition, the same file is 1.93 MB. So "2 MB" on a portal could mean 2,000,000 bytes or 2,097,152 bytes, and the page almost never says which. I can't tell you what any specific portal checks, so I compare the raw byte count against the stricter number. 1,927,707 is under both. A result between 2,000,000 and 2,097,152 bytes is the dangerous zone, and I'd treat it as too big.

When the PDF is mostly text

I also tried a ten-page text-only PDF of 137,782 bytes. All four presets gave the exact same 131,156 bytes, 4.8% smaller. Fonts made up 85% of that file, and this tool doesn't subset fonts (strip out the glyphs that are never used), so there wasn't much left to squeeze. That's one sample, so I'm not claiming every text PDF behaves like this. If yours is still over the limit, I'd go back to the source document rather than keep trying presets. I haven't tested those routes, so I can't put numbers on them.

My checklist now is short: search the PDF to tell scan from text, pick 150 dpi for scans, check the byte count against 2,000,000, then zoom to 200% and read the smallest line before uploading.

Top comments (0)