New Tool Radar

AI PDF

How to Check a Scanned PDF for Structural Problems with qpdf

Check a scanned PDF for structural problems with qpdf --check before you trust it in a workflow.

Schematic illustration of a qpdf check: check the install, run qpdf --check, and read the exit code.

A PDF can look fine on screen and still carry structural damage: a broken cross-reference table, a truncated file, or objects the reader silently repairs. qpdf –check reports those problems without changing the file. This guide runs it on one scanned PDF.

Prerequisites

qpdf installed and a scanned PDF. Work on a copy of the file.

Steps

1. Check the qpdf install

Run qpdf –version in a terminal. Expected result: a version number prints.

2. Run qpdf –check on the PDF

Run qpdf –check scan.pdf. Expected result: a report prints, with no errors or with warnings listed.

3. Read the exit code

Read the exit code of the command. Expected result: the exit code is 0 for a clean file, or 3 when the file has warnings.

4. Record the problems found

Write down each problem qpdf reports, with its message. Expected result: a note that lists the problems or confirms the file is clean.

Practice check: fictional scanned letter with a truncated last page

The table below is fictional practice material. It lists the four checks for the qpdf run.

Check Expected result
Version printed A version number prints
Report printed Problems listed or none
Exit code 3, warnings only
Problems recorded One warning noted

Expected result. qpdf reports one warning, that the file is missing its last bytes, with exit code 3 and a usable file.

Limits

  • qpdf checks structure, not content; a file that passes –check can still hold a misread OCR layer or a blank page, so check the content too.
  • UNTESTED – no OCR tool or AI tool was run; all results above are expected results. The practice file is fictional.

Sources

See all