Guide · Delivery conditions

Build a degraded document dataset by failure mode

A photocopy, a bad embedded text layer, and a visibly corrupted page test different parts of an OCR pipeline. V2 records those conditions separately so you can tell what your parser actually handled.

Four different failure modes

Name the condition before you measure it

“Degraded” can mean that the pixels are hard to read, the visible text was deliberately corrupted, the invisible PDF text layer is unreliable, or the file has no text layer at all. V2 exposes these as separate options and records them in the manifest and annotation. Keeping the axes separate prevents a scan problem from being reported as an OCR error—or a bad embedded layer from being mistaken for bad pixels.

Scan damage

PDF presets are photocopy, faded, and phone_photo, with strength 1–100. They add raster effects such as noise, blur, skew, resolution loss, or uneven lighting. Native files are unchanged by scan settings.

Visible text corruption

--quality controls a measured character-error target against clean reference text. It changes what is printed or rendered and is useful for robustness training. It is not an external OCR score.

Hidden text corruption

--messed-up-text keeps the page appearance clean while embedding corrupted electronic text. It tests parsers that trust a PDF text layer instead of rendering or OCRing the page.

Image-only delivery

--no-text flattens a PDF to page images with no selectable text. It cannot be combined with --messed-up-text. The local baseline then returns empty text because it has no OCR engine.

A short reproducible example

Hold content constant while changing the delivery

Generate two invoices and two letters as photocopy scans:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --type invoice letter --count 2 --seed 42 --quality 100 --scan-preset photocopy --scan-strength 65 --output output/photocopy-pair --validate

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --type invoice letter --count 2 --seed 42 --quality 100 --scan-preset photocopy --scan-strength 65 --output output/photocopy-pair --validate

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --type invoice letter --count 2 --seed 42 --quality 100 --scan-preset photocopy --scan-strength 65 --output output/photocopy-pair --validate

Then the same selection as image-only PDFs, in a separate folder:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --type invoice letter --count 2 --seed 42 --quality 100 --no-text --output output/image-only-pair --validate

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --type invoice letter --count 2 --seed 42 --quality 100 --no-text --output output/image-only-pair --validate

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --type invoice letter --count 2 --seed 42 --quality 100 --no-text --output output/image-only-pair --validate

These are two invoices and two letters in each destination. The same seed helps reproduce the source selection on the same product revision, but the output folders remain separate. The scan run records delivered page geometry and scan settings; the image-only run preserves the canonical source text and produces empty selectable text in the PDF. Use a paired SuiteSpec when you need stable fixture and variant IDs across conditions.

To exercise a bad electronic layer without changing the visible page, set OCR quality below 100. The page stays clean and the hidden text carries the errors:

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --type memo --count 2 --seed 42 --quality 70 --messed-up-text --output output/hidden-text-corruption --validate

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --type memo --count 2 --seed 42 --quality 70 --messed-up-text --output output/hidden-text-corruption --validate

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --type memo --count 2 --seed 42 --quality 70 --messed-up-text --output output/hidden-text-corruption --validate

How to interpret the files

Use the right truth for the right question

QuestionInspectBoundary
What was authored?source_text, canonical pages, annotations, and ground-truth sidecars.This is the pristine semantic source, not necessarily the delivered pixel appearance.
What did the parser receive?The delivered PDF or page images and, where available, delivered_pages.Scan transforms can alter geometry; source and delivered boxes are not interchangeable.
How much text was intentionally changed?The recorded quality settings and source-to-rendered mapping.The measured edit target describes generated corruption, not parser accuracy.
Can the evaluator score it?Use supported evaluation inputs before building a neutral bundle.Visible corruption and corrupt hidden text are currently refused by parser evaluation.

Limits

Choose conditions that match the failure you want to test

  • Choose photocopy, faded or phone-photo effects and adjust their strength. These presets simulate those specific scan conditions.
  • Scan damage is PDF-only. DOCX, XLSX, EML, CSV, and text output keeps its native container and is not rasterized by the scan flags.
  • Quality targets are bounded and measured against generated reference text. Short documents can have rounding allowances; no setting promises a particular external engine's character accuracy.
  • For parser scoring, use quality 100 with supported clean, image-only, or scan conditions. Use visible and hidden text corruption for training or integration tests outside the built-in scorer.

See OCR training data for export and split design, test documents for OCR for neutral scoring, and LayoutLM export for delivered page geometry.