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
- Follow the Getting started guide
- Initialize the Docutain Capacitor SDK as described here
Get the detected text
In order to get the detected text of the entire document, call the following line of code:
import { DocutainSDK } from '@docutain/capacitor-plugin-docutain-sdk'
//...
//scan or import file
//...
try{
const text = (await DocutainSDK.getText()).text
}catch (error) {
console.error(error);
}
In order to get the detected text of a specific page, call the following line of code and specify the page number:
import { DocutainSDK } from '@docutain/capacitor-plugin-docutain-sdk'
//...
//scan or import file
//...
try{
const text = (await DocutainSDK.getTextPage({pageNumber: 1})).text
}catch (error) {
console.error(error);
}