PALATINELABSDocsENES

Pages

↑↓ to moveEnter to openEsc to close

OCR package guide

Read image text with the Windows OCR engine.

Version 2.18.0. Installed versions can differ. Examples are illustrative and not tested.

Jump to actions

Prerequisites

Black text AA PALATINE ZZ on a white background.
Illustrative OCR input: AA PALATINE ZZ. If recognition succeeds, the example filter and trimming give PALATINE.

Shared fields

All inputs are optional.

FieldEditor fieldType and runtime defaultApplies toUse
pdfImagePathPDF pathString⁠; ""ocrCaptureImagebyPathNot used. It shows when Source is PdfPath⁠, and that source always fails. Leave it empty and choose the image source.
pdfURLPDF URLString⁠; ""ocrCaptureImagebyURLNot used. It shows when Source is PdfUrl⁠, and that source always fails. Leave it empty.
pdfPasswordPDF passwordCredential⁠; empty CredentialocrCaptureImagebyPath⁠, ocrCaptureImagebyURLNot used, like the other PDF fields.
pdfPageNumberPage number(s)String⁠; ""ocrCaptureImagebyPath⁠, ocrCaptureImagebyURLNot used, like the other PDF fields.
checkFilterTextFilter the captured textBoolean⁠; falseocrCaptureImagebyPath⁠, ocrCaptureImagebyURL⁠, ocrCaptureWindow⁠, ocrCaptureWindowAreatrue applies the After and Before markers. false ignores them. The filter runs before the trim.
afterSubStrAfterString⁠; ""ocrCaptureImagebyPath⁠, ocrCaptureImagebyURL⁠, ocrCaptureWindow⁠, ocrCaptureWindowAreaWith the filter on, keep the text after the first exact match of this marker, without the marker. Case matters. If the marker is empty or not found, the start does not change.
beforeSubStrBeforeString⁠; ""ocrCaptureImagebyPath⁠, ocrCaptureImagebyURL⁠, ocrCaptureWindow⁠, ocrCaptureWindowAreaWith the filter on, keep the text before the first exact match of this marker in the text left after After, without the marker. If the marker is empty or not found, the end does not change.
checkTrimTextTrim the captured textBoolean⁠; falseocrCaptureImagebyPath⁠, ocrCaptureImagebyURL⁠, ocrCaptureWindow⁠, ocrCaptureWindowAreatrue removes spaces at both ends, after the filter. false keeps them.
ocrLocaleSelect localeOcrLocale⁠; BasedOnLocaleocrCaptureImagebyPath⁠, ocrCaptureImagebyURL⁠, ocrCaptureWindow⁠, ocrCaptureWindowAreaBasedOnLocale (a language of the signed-in Windows user), English⁠, Japanese or Russian⁠. If its language pack is not installed, the step fails and names the languages that are installed.
windowTitleWindow titleString⁠; ""ocrCaptureWindow⁠, ocrCaptureWindowAreaTitle of an open window, e.g. Invoice Preview⁠. The step fails if it is not found. The capture reads the pixels on screen.
windowTitleMatchMatch the titleWindowMatch⁠; ContainsocrCaptureWindow⁠, ocrCaptureWindowAreaContains (part of the title), Exact⁠, Wildcard (*⁠, ?), Regex⁠, or ActiveWindow (the window in front; the title is ignored). Case does not matter. If several windows match, the newest one is used.
waitBeforeCaptureWait before capturing the image (ms)Number⁠; 0ocrCaptureWindow⁠, ocrCaptureWindowAreaMilliseconds to wait before the capture. 0 or less: no wait. The window is found first, so the delay does not wait for a window to open.
OutputTypeApplies toMeaning and binding
resultStringocrCaptureImagebyPath⁠, ocrCaptureImagebyURL⁠, ocrCaptureWindow⁠, ocrCaptureWindowAreaThe text read, after the filter and trim. Save it in a String variable. It can be "" when no text is read. There is no confidence score.

Actions

Capture text by path (ocrCaptureImagebyPath)

Read the text in an image file on the Device, then filter and trim it if you choose.

Inputs

InputEditor fieldType and runtime defaultUse
imagePathOptionSourceImagePathOption⁠; ImagePathImagePath (use this) or PdfPath (always fails).
imagePathImage pathString⁠; ""Path of the image, e.g. samples/text.png⁠. A relative path starts in the Run folder. A PDF file does not work.

Also uses the shared fields: pdfImagePath, pdfPassword, pdfPageNumber, checkFilterText, afterSubStr, beforeSubStr, checkTrimText, ocrLocale.

Outputs

Returns the shared output result.

Example

Use samples/text.png, a white image with large black text AA PALATINE ZZ (see the figure). Set Source=ImagePath, Image path=samples/text.png, Select locale=English, Filter the captured text=true, After=AA, Before=ZZ, Trim the captured text=true. Save result in String recognizedText.

Expected result

If the text is read as AA PALATINE ZZ, result is PALATINE. It fails if the file is missing, the file is not an image, the language is not installed, or the source is PdfPath.

Back to actions

Capture text by URL (ocrCaptureImagebyURL)

Download an image and read its text. No sign-in or custom headers are sent.

Inputs

InputEditor fieldType and runtime defaultUse
imageUrlOptionSourceImageUrlOption⁠; ImageUrlImageUrl (use this) or PdfUrl (always fails).
imageURLImage URLString⁠; ""Web address of an image file, e.g. https://api.example.com/samples/text.png⁠. A web page or PDF fails.
allowInternalNetworkAllow an address inside the networkBoolean⁠; falsefalse⁠: refuses an address on this PC or a private address, also after a redirect. true⁠: allows it, for a service you control in your network.

Also uses the shared fields: pdfURL, pdfPassword, pdfPageNumber, checkFilterText, afterSubStr, beforeSubStr, checkTrimText, ocrLocale.

Outputs

Returns the shared output result.

Example

Put the sample image at a test address such as https://api.example.com/samples/text.png. Set Source=ImageUrl, Image URL=https://api.example.com/samples/text.png, Select locale=English, Trim the captured text=true, Filter the captured text=false. Save result in downloadedText.

Expected result

result is AA PALATINE ZZ, without spaces at the ends. With allowInternalNetwork=false, an address on this PC or a private address fails before any download. It also fails if the download fails, the file is not an image, the language is not installed, or the source is PdfUrl.

Back to actions

Capture window (ocrCaptureWindow)

Read the text of a whole window on screen, after the optional delay.

Inputs

Uses the shared fields: windowTitle, windowTitleMatch, waitBeforeCapture, checkFilterText, afterSubStr, beforeSubStr, checkTrimText, ocrLocale.

Outputs

Returns the shared output result.

Example

Open a test window titled Invoice Preview with large text Total 42. Set Window title=Invoice Preview, Match the title=Exact, Wait before capturing the image (ms)=500, Select locale=English, Filter the captured text=false, Trim the captured text=true. Save result in windowText.

Expected result

result has the text of the whole window, which can include its title and buttons, and so Total 42. It fails if the window is not found or has no area.

Back to actions

Capture area (ocrCaptureWindowArea)

Read the text in one rectangle of a window on screen. Use it to leave out the title and other controls.

Inputs

InputEditor fieldType and runtime defaultUse
leftArea left (px from the window)Number⁠; 0Pixels from the window's left edge.
topArea top (px from the window)Number⁠; 0Pixels from the window's top edge.
widthArea width (px, 0 = to the window edge)Number⁠; 0Width in pixels. 0 or less goes to the window edge.
heightArea height (px, 0 = to the window edge)Number⁠; 0Height in pixels. 0 or less goes to the window edge.

Also uses the shared fields: windowTitle, windowTitleMatch, waitBeforeCapture, checkFilterText, afterSubStr, beforeSubStr, checkTrimText, ocrLocale.

Areas are whole pixels from the window's outer top-left corner, not percentages. Parts outside the window are cut off. If no area is left, the step fails.

Outputs

Returns the shared output result.

Example

Use a test Invoice Preview window of at least 500 by 300 pixels, with Total 42 inside the area that starts 40 px from the left and 80 px from the top. Set Window title=Invoice Preview, Match the title=Exact, Area left=40, Area top=80, Area width=400, Area height=120, Wait before capturing the image (ms)=0, Select locale=English, Trim the captured text=true. Save result in totalText.

Expected result

Only the 400 by 120 pixel area is read. result is Total 42. If the pixels are not clear, the text can be empty or different.

Back to actions