Extract OCR operation (op_extract_ocr_v2.py)

Tabla de contenidos

The Extract OCR operation (op_extract_ocr) gets the text of a document so you can search it, read it in the OCR panel and use it to extract fields. It works with scanned documents, images and digital PDFs, and lets you choose the OCR engine that best fits your documents.

Configure the operation

Add the operation to your process and click the edit icon to open Edit operation parameters. All parameters are optional:

Extract OCR operation parameters

  • Engine: the engine that runs the OCR. If you don’t choose one, Tesseract is used. See the engines table below.
  • Force: when enabled, OCR runs even if the PDF already contains text. When disabled (default), the text already in the PDF is read first and OCR only runs on pages with no text.
  • Language: language of the text. If left empty, Spanish is used (except for Tesseract and Azure Vision, see the table).
  • Pages: pages to process, separated by commas. Ranges are allowed: 1,2,6-9 processes pages 1, 2, 6, 7, 8 and 9. If left empty, all pages are processed.
  • Split lines: keeps the line breaks of the extracted text (enabled by default).

Supported engines

Engine What it is Language When to use it
tesseract Open-source engine that runs on your own instance. It is the default engine. Tesseract codes: spa, eng or several at once, such as spa+eng. If left empty, English is used. Clean, well-scanned documents, with no per-page cost and without sending documents outside.
Google Google Cloud Vision, in its European region. English name, for example Spanish. High accuracy with low-quality scans, photos or handwriting. It processes the whole document at once, so it ignores Pages.
Azure vision Microsoft Azure AI Vision (text reading). Detected automatically; Language is ignored. High accuracy and documents in several languages.
PaddleOCR AI-based open-source engine that runs on your own instance. Spanish, English, French, German, Italian, Portuguese, Chinese, Japanese, Korean, Arabic or Russian. Any other value uses Spanish. Better accuracy than Tesseract without sending documents outside, especially for Asian languages or Arabic.
textract Reads the text the file already contains. Not applicable. Digital PDFs and office files. It does not work with scanned documents.

Google and Azure vision are cloud services: the Athento team needs to enable the service on your instance. PaddleOCR also has to be installed on the instance; once installed, reinstall the operation so it appears in the engine selector.

The selector also shows ocro_rest, ocro_multipage, tocr and athentose_cloud. These are older engines kept so existing configurations keep working. For new configurations, use one of the engines in the table.

What text is extracted for each type of document

  • Text and office files (.txt, Word, Excel…): their text is read directly, without OCR.
  • Digital PDFs: with Force disabled, the text of each page is read and OCR only runs on pages with no text. This saves time and engine calls.
  • Scanned PDFs and images: OCR runs page by page with the selected engine.

View the extracted text

When the document finishes processing, you will see the text of each page in the OCR panel, on the right of the document. If you don’t see this panel, enable it from the form configuration.

OCR panel in the document view