Skip to main content
Version: 2027 R1

Add a text layer

An action from the OCR and scanning category that adds a text layer to all PDF files attached to the workflow instance. Recognizing text (OCR) makes scanned documents searchable by content.

Basic configuration​

The Basic tab of the Properties panel contains settings shared by every action in an automation: the Active toggle, the Action type field, the Documentation field, the Use action template toggle (when enabled, the action takes its configuration from the selected action template defined in the process), the Execution condition section (determines whether the action always runs or only when a custom rule is met), and the Runtime error handling section (the message and numeric error code returned when the action fails). Because these settings are not unique to the Add a text layer action, they are described in detail in the Actions chapter.

Basic tab in the Properties panel of the Add a text layer action

Advanced configuration​

The Advanced tab contains fields specific to this action, grouped into the Basic settings, New file configuration (visible only for the matching mode) and Input attachments selection criteria sections.

Basic settings​

Basic settings section in the Advanced tab of the Add a text layer action

  1. Output file resolution – a toggle between Keep original file resolution and Resolution in DPI. Selecting the second option reveals a numeric field for setting the output file resolution, from 50 to 600 DPI.

  2. Image layer quality – a percentage value defining the quality of the image layer saved in the output file, compared to the original file. A value of 0% means the output file will contain no image layer — only the recognized text will be saved.

  3. Output file format – the format of the file created after the text layer is added, set depending on the ABBYY FineReader license:

    • PDF
    • PDFA
    • DOCX
  4. Text layer in front of image – defines whether the text layer should be placed in front of the image. Recommended for files with low resolution and poor image quality. The option is available only for the PDF and PDFA formats — it is hidden when the DOCX format is selected.

  5. Generate preview image for OCR AI – generates a preview used only in the OCR verification step. A preview generated by the ABBYY FineReader engine is more precise than the preview generated in the OCR AI step, but it may increase the size of the database.

    caution

    Once this option is checked, a separate preview will no longer be created in the OCR AI step, which shortens its duration. Generating the preview with the ABBYY FineReader engine extends the total time needed to add the text layer.

  6. Number of initial pages of the document – a toggle between All pages and First pages. The second option reveals a numeric field for the number of initial document pages for which a text layer will be created. Applies to documents that have pages, such as PDF or TIFF files.

  7. Language selection – a toggle between Automatic and Selected, determining the language used for the text recognition process.

    • Automatic mode is recommended when the language of the processed documents is not known. Using it may result in lower text recognition quality and a longer processing time.
    • Selecting Selected reveals the Text layer language field, where one or more languages can be checked from the list. If the language of all documents is known, selecting it improves recognition speed and accuracy — choosing the wrong language may cause diacritical marks to be ignored or recognized incorrectly. If the documents are in Russian, Ukrainian, or Hebrew, it is recommended to additionally select English — this enables correct recognition of Latin characters.
    info

    The language list is displayed in English only, regardless of the Designer Studio interface language.

  8. Priority – a toggle between Nighttime OCR and Set manually, determining the order in which attachments are processed.

    • Selecting Set manually enables a numeric field ranging from 1 to 10 — files with priority 1 are processed first, in ascending order.
    • Checking Nighttime OCR automatically sets the priority to 11 — files with this priority are processed only during night hours, configurable in the Schedules node of the Services configuration (System settings).
    • The current state of the queue elements can be checked in the attachment processing reports.
  9. Error handling – determines what happens after the first error occurs while processing a queued element:

    • Retry operation automatically – the default behavior for most service queues. After the first error, processing of the element is retried four more times with an increasing time interval, up to five attempts in total. The element then waits for a user decision — in the attachment processing reports in Designer Studio it can be removed or its attempt counter reset to 0.
    • Wait for user decision – after the first error, processing of the element is paused. It can then be removed or its attempt counter reset to 0 in the attachment processing reports (which triggers another processing attempt).

    Changing the setting from Wait for user decision to Retry operation automatically resumes processing of all pending elements with an attempt counter below 5. Changing it the other way pauses processing of elements with an attempt counter above 0. In both cases this applies only to elements queued by the action being modified.

  10. Mode – how the file with the generated text layer is saved:

    • New attachment – after the text layer is generated, a new attachment is added to the workflow instance.
    • New version of existing attachment – a new version is created for the attachment the text layer was generated for.
    • Overwrite attachment – the attachment the text layer was generated for is replaced with a new file of the same name.

New file configuration​

This section is visible only when the Mode field is set to New attachment.

New file configuration section in the Advanced tab of the Add a text layer action

  1. File name – the name of the newly created attachment. The value can be built dynamically by inserting variables with the fx button.

  2. File description – the description of the newly created attachment, with the same option to insert variables.

  3. Category – the category the newly created file will be assigned to:

    • None – the attachment will be saved without an assigned category.
    • Dynamic – reveals the Dynamic expression field for constructing the category dynamically (using variables from the fx button) or entering it manually, in ID#Name format or as an ID alone. If only a category name is provided and it is not found in the source, the action ends with an error; if only an ID is provided and it is not found in the source, the entered phrase is treated as the name of a category from outside the source.

    If categories have been defined for attachment fields in Designer Studio, they will also be available for selection in the Category field.

Input attachments selection criteria​

Input attachments selection criteria section in the Advanced tab of the Add a text layer action

  1. Input files types – determines which attachments a text layer will be generated for:

    • All files – a text layer will be generated for all supported file types.
    • PDF only – a text layer will be generated only for PDF files.
    • Files filtered by regular expression – a text layer will be generated for files selected by the regular expression entered in the Filter by regular expression field.
  2. Filter by regular expression – a field visible when Files filtered by regular expression is selected, used to specify the files a text layer will be generated for.

    Example

    Entering .*_ocr\.pdf$ will select files with the suffix "_ocr.pdf" in their name, such as "faktura_ocr.pdf" or "waznyDokument_ocr.pdf".

  3. Category – the category files are selected from for processing:

    • All – files are added to the text layer generation queue regardless of category.
    • Dynamic – reveals the Dynamic expression field, for constructing the category dynamically (using variables from the fx button) or entering it manually, in ID#Name format or as an ID alone. Attachments belonging to the indicated category are selected based on ID; if a search by ID returns no results, the entered phrase is treated as the name of a category from outside the source.
    • None – only files that do not belong to any category are added to the queue.

    If categories have been defined for attachment fields in Designer Studio, they will also be available for selection in this field.

  4. Dynamic expression – a field visible when Dynamic is selected, described in point 3.

  5. Skip PDF files with text layer – when checked, PDF files that already have a text layer are skipped during processing.

  6. Skip PDF files with signature – when checked, PDF files that contain a digital signature are skipped during processing.

info

An example configuration for searching attachments by content is described in the article Searching for attachments using the "Add a text layer" action on our technical blog.