Skip to main content

Text Recognition

After a successful scan or import of a document, you can get the detected text of the entire document or single pages.

Initialization

Get the detected text

In order to get the detected text of the entire document, call the following line of code:

using Docutain.SDK.MAUI;

//...
//scan or import file
//...

var text = await DocumentDataReader.GetTextAsync();

In order to get the detected text of a specific page, specify the page number:

var text = await DocumentDataReader.GetTextAsync(1);

Pages start at 1. Passing -1, which is the default, returns the text of the entire document.

tip

DocumentDataReader.GetText is also available synchronously. We recommend the asynchronous variant, since it keeps your UI thread free. See Asynchronous Methods for more details.

info

An empty result means that the document contains no text, or that the text recognition failed. In the latter case, DocutainSDK.LastError states the reason. See Error Handling for more details.