OCR and compression change the image inside a PDF, and a QR code that loses contrast or sharpness stops scanning, even though it still looks fine. The check is simple: scan the code in the processed file with a phone. This guide checks one QR code after OCR and after compression.
Prerequisites
A scanned PDF with a QR code, OCRmyPDF or a similar tool, and a phone with a camera. Work on a copy of the file.
Steps
1. Run OCR on the PDF
Run OCRmyPDF on the PDF and save the output. Expected result: the output PDF is created with a text layer.
2. Scan the QR code in the OCR output
Open the output PDF and scan its QR code with a phone. Expected result: the code scans and opens the expected link.
3. Compress the PDF and scan the code again
Compress the PDF with the optimizer and scan the code again. Expected result: the code still scans after compression.
4. Record the result for both files
Record whether the code scanned in the OCR output and in the compressed file. Expected result: a note that says the code scanned in both files.
Practice check: fictional event flyer PDF with one QR code
The table below is fictional practice material. It lists the three checks for the QR code.
| Check | Result |
|---|---|
| Original scan | Scans |
| After OCR | Scans |
| After compression | Scans |
Expected result. the QR code scans in the original scan, after OCR and after compression.
Limits
- A QR code that scans once can still fail on a different phone or in poor light, so test it on more than one device when the code matters.
- UNTESTED – no OCR tool or AI tool was run; all results above are expected results. The practice file is fictional.
Sources
- OCRmyPDF Cookbook – –sidecar writes OCR text to a companion file; –output-type pdfa/pdf picks the output; –optimize shrinks the file; –mode strip removes the text layer. Checked 2026-11-29.
- Adobe Acrobat, Extract key data from scanned PDFs with OCR – Try to select a word first; OCR adds text you can search, select, copy and extract; tables can flatten, so compare totals with the original page. Checked 2026-11-29.
