tetrak_ocr.pdf_output

Write a searchable PDF: the scan, with the transcript invisible over it.

This is the output that makes a transcript useful without asking a vendor for anything. Preservica Starter has no OCR but full-text-indexes text-embedded PDFs; Omeka Classic’s PDF plugin needs the text layer to already exist; CONTENTdm and AtoM index it. It is also the accessibility feature, because the same layer an indexer reads is what a screen reader reads.

Why the text is not positioned per word

The obvious construction puts each word’s text invisibly over that word, and that is what Tesseract’s own PDF renderer does. It was measured and rejected for this release. Against the corpus ground truth, character similarity of a word-positioned layer versus the plain transcript:

inside-facts-1930-page-six 0.0921 positioned 0.3657 transcript inside-facts-1930-cover 0.0407 positioned 0.3522 transcript carthay-circle-postcard-back 0.8066 positioned 0.9136 transcript

Word recall is identical in every case – the words are all present either way – so this is purely reading order, and it is not a defect in our implementation: Tesseract’s native renderer scores 0.1137 on the first of those, no better than ours. Any word-positioned layer inherits it, OCRmyPDF included.

Content-stream order is what a screen reader announces, so for the two things this feature exists for – indexing and accessibility – the better-ordered transcript wins. Per-word boxes become load-bearing at ALTO/hOCR, where coordinates are the point rather than a side effect. See brief 008 (searchable PDF).

The consequence worth knowing: the text layer is byte-identical to the sidecar, and selecting text in a viewer will not align with the words on the page.

Functions

searchable_pdf_for(path, transcript, ...[, ...])

Write the searchable PDF for one transcribed document.

select_font(text[, font_path])

Return a registered font name that can encode text.

write_searchable_pdf(pages, destination, *)

Write pages as a searchable PDF at destination.

Exceptions

PdfFontError

No available font can encode the transcript.