Skip to content

DocumentReaderProcessor methods


Prepares SDK files. The method must be run before initialization:

await processor.prepare();


Initializes the processor. The method must be run after preparing. Accepts an object with a base64 license. An object with a license must be installed only to work on test environments. Do not install an object with a license in production mode:

await processor.initialize({license: 'BASE64_LICENSE_KEY'});


The method starts the video stream and starts the process of recognizing the document. Returns the result of document processing:

const result = await processor.startRecognition();

To process multi-page documents, add the callback function to the method. The callback function takes in an object with an intermediate result of processing, a method for starting the next page and a method for completing the process:

 * @param {object} currentPage - Page data.
 * @param {object} - Page processing result.
 * @param {function} currentPage.startNextPage - The method of starting the recognition of the next page.
 * @param {function} currentPage.finishRecognition - Finish the process and return the result.
async function pageListener(currentPage) {
    setTimeout(async () => {               
        await currentPage.startNextPage(); // Will start recognition of the next page in 3 seconds.
    }, 3000);                              // During this time, you can tell the user to turn the document over.
const result = await processor.startRecognition(pageListener);


Processes document files. Can process FileList or Blob array:

const file = 'FileList or Blob array';
const result = await processor.processImage(file);


Stops the document recognition process and ends the video stream.