The OCR (Optical Character Recognition) Field type lets you convert written or printed information into text via your device's camera.
This premium feature allows a user to capture or upload an image and rapidly convert any text found in the image into raw text or JSON response.
In this article
- Setting up an OCR Field
- Isolating Specific Text
- Result Examples
- Raw Text
- Raw JSON
Note, the OCR field requires an internet connection to return image text.
Setting up an OCR Field
After creating a new Form screen, you will be taken to the Form Designer screen. The Form Designer screen provides a visual view of your Form and a drag-and-drop approach for creating your Form design.
Along the left section of the Designer, you will find a column of Basic and Advanced Field types.
The OCR Field can be found under our Advanced Field types.
Unique properties specific to the OCR field are:
Result Mode
- Raw Text
When this option is chosen, the raw text result will be displayed (extracted from the image). - JSON
The complete OCR JSON response will be available in other fields via the JSONVAL() formula when this option is chosen.
For more information on JSON formula, please review Formula Cheat Sheet - Data Interchange.
On Capture Action
- Define an action each time a successful OCR result is returned.
When extracting specific information out of a JSON result , https://jsonpathfinder.com/ might be of assistance.
Additional Features
As with the media field type, the OCR field also has support for the following field features:
- Is Personal Data - Indicates that data captured in this field may contain personal or sensitive data, which can be anonymized when exported from the platform.
- Capture Only - Users usually have the option to capture media or to choose an existing file. Ticking this option will remove the "Choose" button, forcing the user to capture the image through the camera.
- Copy to Device Gallery - By default, the app stores captured photos & video in a private location. This option causes the app to copy captured files into the device's Album/Gallery area for general access.
NOTE: Is Personal Data - Use of this option does not grant or imply additional security, protection and privacy of data.
Isolating Specific Text
When you don't need all the text on an image, ensure you Allow Image Cropping.
An Advanced Options property enables the selection of a specific area for text conversion of the captured or chosen image.
Result Examples
Raw Text
Image uploaded from device gallery.
Raw JSON
Image uploaded from device gallery.
The above image depicts RAW JSON Results (Text field) with its dynamic value property driven from the OCR Field - JSON Mode's (OCR field) data name.
Form Designer Build:
The JSON result can be processed using JSON Path Syntax.
JSON Result (full)
JSON Result (retrieve all words text)
Syntax:
$.readResults[0].lines[*].words[*].text
However, in a Text field's dynamic value, the above syntax would need to be used with our JSON() function.
Formula:
SUBSTITUTE(STRING(JSONLIST({{myOCRfieldJSON }}, 'readResults[0].lines[*].words[*].text')) , '|' , '\n')
If there's a specific value you want to extract then replace the '*' with a numeric value.
For example, to capture the 2nd line in an OCR Result:
STRING(JSONLIST({{myOCRfieldJSON}}, 'readResults[0].lines[1].text'))