Optical character recognition in Directus
How to use OCR using TTA in Directus.

Using OCR inside of Directus
Leverage TTA's OCR interface to seamlessly integrate text recognition for PDFs and images within Directus.
The interface will allow you to use OCR on 3 places:

OCR result
After using an OCR option on a file, a popup with an image preview will appear.
This window can be dragged around your screen for convenience.
Using the OCR Result
The preview will display a highlighted area with the recognized text.
- You can click on the text to make a selection.
- After selecting, click on any input field to fill it with the selected text.
Multiple pages in a PDF
When using PDFs with multiple pages, you can navigate through the pages using the arrows at the bottom of the preview.These will only be visible when the PDF has more than one page.

Using OCR inside of Directus Flows
Use TTA's OCR operation to optical character recognition into Directus Flows. It works with images and PDF`s and extracts the text from them based on FileID.
It supports the following response types:
It supports the following response types:
- Text
- HOCR (HTML like structure)
Operation Settings

Inside of the operation you have the following options:
Option | Description | Type |
---|---|---|
File ID | The ID of the file you want to process. | string |
Mode | Can be either 'text' or 'hocr'. | string |
Language | Pick a language for the OCR process. | Dropdown or string |
Output
The output of the operation depends on the mode you selected. The output will be a string with the text or hocr data.
Using OCR in your own Directus extension
const result = await globalThis.TTA.OCRBasedOnAsset(
fileID,
language, // for example eng for english
mode // can be text or horc
);
Output
The output of the operation depends on the mode you selected.
The output will be a string with the text.