Module Properties > OCR
OCR (optical character recognition) reads the text in image files and scanned PDFs with the Tesseract OCR engine, so content that is only a picture of text can be stored, displayed and searched. OCR is off by default and is turned on separately in each place that uses it. Two shared module properties, OCR: Minimum Confidence and OCR: Minimum Visible Words, control how it behaves everywhere it is turned on.
Where OCR Is Used
Choosing What to Read
Each place that uses OCR lets you choose which kinds of files are read. Nothing is read until at least one is selected.
-
Images: .png, .jpg, .jpeg, .tif, .tiff, .bmp, .gif files. Every page of a multi-page TIFF is read.
-
Scanned PDFs: PDFs that are pictures of pages rather than typed documents. See How a Scanned PDF Is Recognized below.
Select only what the module needs. The two choices carry different costs and risks:
-
An image is a single OCR pass. A scanned PDF can be many pages, and each page takes several seconds.
-
OCR reads whatever it finds in an image. On a module whose files include photographs, such as headshots, product photos or site pictures, selecting Images either fills the attribute with stray characters from the photo or empties it, replacing anything entered there by hand.
Performance: OCR runs while the record saves, so a save waits for it to finish. Data Transfers that run the module's triggers do the same work for every row. Turn OCR on only on modules whose files need it.
How a Scanned PDF Is Recognized
A PDF is treated as scanned when it contains images and every page has fewer visible words than OCR: Minimum Visible Words. A typical scan is a large page image with little more than a title, stamp or page number on it.
-
Many scanners add their own hidden OCR text to a scan. That hidden text is not counted, because it is often poor. When the PDF is read with OCR, the new OCR text replaces it.
-
A single typed page anywhere in the PDF means it is not treated as scanned, and its text is extracted as usual. A PDF that mixes typed pages with scanned pages is therefore not read with OCR.
-
PDFs of up to 25 pages are read with OCR. A longer PDF is converted as usual, which keeps the full text a scanner may have embedded in a long document. A PDF containing a large sheet such as a plan or map is read at a lower resolution throughout, to keep the work bounded.
Settings
-
OCR: Minimum Confidence (0 to 100, default 60): the OCR engine scores how sure it is of each word it reads. When the average falls below this value, the OCR text is discarded. A PDF is then converted as usual, and an image leaves the attribute empty, clearing any content from a previously uploaded file. Clean scans of typed pages usually score above 90. Drawings, plans, maps and photographs usually score well below 60 and produce stray characters, which this setting keeps out. Set it to 0 to keep all OCR text.
-
OCR: Minimum Visible Words (1 to 200, default 20): a page with fewer visible words than this counts as scanned. Raise it if scanned PDFs with a title block on each page are not being read. Values near the top of the range can treat a short typed document as scanned when it carries an image such as a letterhead logo, replacing its typed text with OCR text. This setting does not apply to image files.
Results
-
OCR text is inserted as plain text, with line breaks and extra spaces collapsed. Settings that insert other file types as HTML, such as Document Content Attributes: Insert PDFs as HTML?, do not apply to OCR text.
-
When OCR finds no text, falls below the minimum confidence, or fails, a PDF is converted as it would be with OCR turned off, and an image leaves the attribute empty.
-
OCR reads English text.
Troubleshooting
Each OCR read writes a trace message under OcrTextExtractor with the file, the confidence the engine reached, the minimum confidence setting, the number of characters read, and whether the text was discarded. Comparing the confidence of good and poor results on a few of the module's files is the quickest way to choose a minimum confidence.
/Uploads/Documents/Resolution-2024-07.pdf: confidence 91, minimum 60, 2140 chars
/Uploads/Plans/Sheet-04.pdf: confidence 36, minimum 60, 411 chars, discarded