Skip to content

OCR Get Lines

Type: ocr-get-lines  ·  Package: OCR Activities v1.2.5  ·  Output: List<object>

Recognizes the text of an image and returns a structured list of lines, each with its words and the coordinates (bounding box) of every element. It is the “detailed” version of OCR: instead of a block of text, it gives you the position of each line and word, useful for layout analysis or to locate data spatially.

Runs OCR on the image and returns the detected lines, in the engine’s reading order, with their words and coordinates. For most cases OCR Recognize File (plain text) is enough; use Get Lines when position matters. This activity has no preprocessing.

ParameterTypeDefaultDescription
pathstring—Path to the image file (.png, .jpg, .bmp, .tiff).
ParameterTypeDefaultDescription
languagestring"eng"Text language: Tesseract code (eng, spa, eng+spa) or regional tag (es-CO, en-US). See language.

Returns a List of lines. Each line is a dictionary:

KeyTypeContent
textstringLine text (its words separated by one space).
x, ynumberTop-left corner of the line (px).
width, heightnumberSize of the line (px).
wordsListThe words of the line; each with text, x, y, width, height.

Coordinates are image pixels, with the origin at its top-left corner. If the image has no readable text, the list is empty.

Find the line that contains the total:

OCR Get Lines path = imagePath language = "spa" → output: lines
Log message = "Lines detected: " + count(lines)
For Each items = lines itemVariable = line
└─ activities:
If condition = startsWith(str(line["text"]), "Total")
└─ then:
Log message = "Total at y=" + line["y"] + ": " + line["text"]
MessageCause and fix
File not found.The path does not exist on the robot’s machine.
'path' is required.path is missing.
Tesseract language '…' not found at '…'. Available: [eng, spa].The language code is not installed.