FastBankConvertFastBankConvert home

Clean Up Scanned PDF for OCR: Speckles, Shadows, Edges

By FastBankConvertPublished May 12, 2025Updated May 12, 2025

To clean up a scanned PDF for OCR, fix the page flaws that create false characters or hide real ones: straighten the page, crop away dark scanner borders, even out shadows and remove dust specks. Go gently. Heavy sharpening or an aggressive black-and-white threshold can erase thin strokes, and a lost decimal point costs more than a speck.

Which scanned PDF flaws are worth cleaning before OCR?

The flaws worth cleaning are the ones OCR mistakes for content or that hide content from it. Specks read as punctuation, dark borders read as lines or letters, shadows swallow faint print, and a tilted page scrambles rows. Cosmetic issues such as a slightly yellow paper tone or a small margin stain rarely change the result.

A quick way to decide is to look at the scan at 100 percent zoom over the area that matters, which on a statement is the transaction table. Ask four questions:

  1. Are there dots or marks near the numbers that are not part of the print?
  2. Is there a dark band along any edge of the page?
  3. Is one side or corner noticeably darker than the rest?
  4. Do the rows of text run level, or do they slope?

If the answer to all four is no, skip clean-up and run OCR. Each filter you apply changes the image, and an unnecessary change is a chance to damage something. A clean flatbed scan of a flat page often needs nothing at all.

Some files never need this. A screenshot from a banking app has no dust, no shadow and no skew, because it was never on paper, and converting a bank app screenshot to Excel covers its own, different issues. A PDF downloaded from the bank has real text and needs no OCR at all.

Despeckling dust and toner specks on scanned statement pages

Despeckling removes small isolated dots from a scanned page: dust on the scanner glass, toner spatter from a copier, or paper fibres. Those dots matter on a statement because OCR can read a speck beside a number as a decimal point, a comma or a minus sign, which changes the amount without any visible error.

Most scan-editing tools have a despeckle or "remove noise" filter. It works by deleting dark clusters smaller than a set size. The setting is the whole game: too small and the specks stay, too large and the filter starts deleting the dots that belong to the text, such as decimal points, the dot on an "i" and the period after an abbreviation.

Start with the smallest setting the tool offers and look at an amount column at 200 to 400 percent zoom before and after. Every decimal point should still be there. If any have gone, step back down. On statements, a few stray specks in the margin are harmless, while one missing decimal point in the amounts is a hundredfold error.

Prevention is cheaper than cleanup. Wiping the scanner glass with a dry lint-free cloth before a batch removes the dust that would otherwise appear on every page in the same place. A speck that repeats at the same spot on each page is a clear sign of dirty glass rather than dirty paper.

Cropping dark scanner borders and black page edges

Dark borders appear when the scanner captures the area around a page, often because the lid was open. They are a problem because OCR may treat a black band as a ruled line, a column edge or a run of characters, and some engines struggle when a large dark area surrounds the text.

The documentation for one open-source engine is direct about this. Tesseract's guidance on improving OCR quality warns that large borders can cause problems, and also that text with no border at all can cause problems. The aim is a clean white margin around the text, not a crop tight to the first letter.

To crop, select the page area and leave a margin of a few millimetres of white on every side. Most PDF editors and scanner apps have a crop or "auto-crop" tool. Auto-crop works well on dark borders against white paper and less well on a page with a dark header band, which it may mistake for the edge.

Two related fixes belong with cropping. Rotate any page that was scanned sideways or upside down, since a few engines do not rotate automatically. And straighten a tilted page before you crop, because cropping a skewed page tightly can cut off the corners of the text. Whether to straighten a scanned PDF before conversion covers when skew is worth fixing.

Evening out page shadows and grey scan backgrounds

Shadows and uneven backgrounds come from pages that did not lie flat: a fold line, a curled corner, or the spine of a bound book. The paper turns grey in that area, and faint print on grey becomes hard to separate from the background. OCR then drops characters or reads the shadow edge as a stroke.

The Tesseract quality guide notes that its own black-and-white conversion can give poor results when the page background is of uneven darkness. Fixing the background before OCR helps any engine. Look for a filter called "background removal", "normalize", "flatten illumination" or "whiten background". These filters estimate the paper colour across the page and lift darker areas toward white, leaving the text alone.

Use the gentlest setting that clears the shadow over the text you need. A fold shadow that crosses only the margin can stay. A shadow that crosses the amount column needs fixing.

Better still, avoid the shadow at the scanning stage:

  • Unfold the page and press it flat under a book for a few minutes before scanning.
  • Close the scanner lid fully, or place a sheet of white paper over a thin page to block light from behind.
  • For a phone photo, use even light from above and avoid standing between the lamp and the page. Glare, shadows and curved pages in table photos covers that case.

Can clean-up filters make scanned text harder to read?

Clean-up filters can make scanned text harder to read when they are set too strong or applied when nothing needed fixing. Sharpening adds halos that turn into stray strokes, an aggressive black-and-white threshold erases faint digits, and heavy despeckling deletes decimal points. Each one trades a cosmetic gain for lost characters.

The most common offenders:

  • Sharpening. It makes text look crisper on screen, but it adds light and dark fringes along each stroke. OCR can read those fringes as part of the character, turning a 3 into an 8.
  • Hard threshold. Converting to pure black and white with a high cut-off drops anything lighter than the cut-off, including thin strokes and pale grey print. Greyscale gives the OCR engine more to work with.
  • Strong despeckle. As above, it removes the small dots that matter.
  • Heavy JPEG compression. Saving a cleaned image at low quality adds blocky artefacts around every letter. Save cleaned pages losslessly, or at high quality.
  • Repeated passes. Running the same filter twice, or several filters that overlap, compounds the damage.

Pages with pictures need extra care. Statements that include images of paid checks mix printed text with grey photographs, and a threshold that suits the text can turn a check photo into a black block. What OCR does with bank statement check images explains why those thumbnails rarely matter for conversion anyway.

Always keep the original scan. If a cleaned page gives worse OCR than the raw one, you want to be able to go back.

A clean-up order for scanned PDF pages before OCR

The order of clean-up steps matters because each step works best on the output of the one before. Geometry comes first, then the background, then the small details, and a zoomed check comes last. Running despeckle before cropping, for instance, wastes effort on border noise you are about to cut away.

Here is a sequence to start from. The settings are suggested starting points, not fixed values. Skip any step whose problem your page does not have.

  1. Rotate pages to upright. Fixes sideways and upside-down scans.
  2. Deskew so rows run level. Start with automatic deskew and check one page.
  3. Crop dark borders, leaving a white margin of a few millimetres.
  4. Even the background with the lightest setting that clears shadows over the table.
  5. Despeckle at the smallest size, then check decimal points at high zoom.
  6. Keep greyscale unless your tool requires black and white; if it does, use a moderate threshold and check faint print.
  7. Check a sample by zooming into one amount column on one page and comparing it with the original scan.

After clean-up, run OCR and check the output against the page. The running balance on a statement is the best single check, and the guide to checking scanned PDF output against the page walks through it. If you need a few values from the page rather than every row, extracting fields from a PDF into Excel covers that narrower job.

FastBankConvert is built to read scanned statement PDFs as well as digital ones, with scans taking longer, and it flags a statement whose balances do not add up before you download. It is getting ready to open; the homepage has the details.

All posts in Scanned and image statements