Skip to main content

DocutainSDKPlugin

Main class of the Docutain SDK.

Methods

initSDK()

initSDK(args): Promise<void>

Initializes the Docutain SDK. This method needs to be called prior to using any functionality of the Docutain SDK.

Parameters

ParameterType
argsobject
args.licenseKeystring

Returns

Promise\<void>


scanDocument()

scanDocument(args): Promise<object>

Starts the document scanner.

Parameters

ParameterType
argsobject
args.configDocumentScannerConfiguration

Returns

Promise\<object>

status
status: string;

loadFile()

loadFile(args): Promise<void>

Parameters

ParameterType
argsobject
args.filepathstring

Returns

Promise\<void>


getText()

getText(): Promise<object>

Detects the text of the currently loaded document and returns it.

Returns

Promise\<object>

text
text: string;

getTextPage()

getTextPage(args): Promise<object>

Detects the text of the currently loaded document and returns it.

Parameters

ParameterType
argsobject
args.pageNumbernumber

Returns

Promise\<object>

text
text: string;

setAnalyzeConfiguration()

setAnalyzeConfiguration(args): Promise<void>

This method sets the analyze configuration.

Parameters

ParameterType
argsobject
args.configAnalyzeConfiguration

Returns

Promise\<void>


analyze()

analyze(): Promise<object>

Analyzes the currently loaded document and returns the detected data.

Returns

Promise\<object>

data
data: string;

writePDF()

writePDF(args): Promise<object>

This method generates a PDF document from the loaded or scanned pages.

Parameters

ParameterTypeDescription
argsobject
args.fileUristringthe file path where to save the PDF document.
args.overWritebooleanif file already exist, indicate whether to override it or to append number, e.g. TestPDF(1).pdf.
args.pageFormatPDFPageFormatthe PDF page format, refer to PDFPageFormat.
args.maxSizeKB?numberthe maximum file size in KB of the PDF or 0 if no compression should be applied. E.g. if you want a max of 10MB, set it to 10 * 1024. The PDF will only be compressed if the uncompressed PDF would exceed the max you have set. Please be aware, that if the PDF gets compressed, the quality decreases and the PDF generation will take longer.

Returns

Promise\<object>

the file path if PDF document was generated successfully, null otherwise.

fileUri
fileUri: string;

setLogLevel()

setLogLevel(args): Promise<void>

This method sets the log level, which determines the severity of the message.

Parameters

ParameterType
argsobject
args.logLevelLogLevel

Returns

Promise\<void>


getTraceFile()

getTraceFile(): Promise<object>

This method returns the Trace file which includes logging and error messages.

Returns

Promise\<object>

fileUri
fileUri: string;

deleteTempFiles()

deleteTempFiles(args): Promise<void>

This method deletes all temporary files created by the Docutain SDK.

Parameters

ParameterType
argsobject
args.deleteTraceFileContentboolean

Returns

Promise\<void>


writeImage()

writeImage(args): Promise<object>

This method generates a JPG from the loaded or scanned page and saves it to a local file.

Parameters

ParameterType
argsobject
args.pageNumbernumber
args.fileUristring

Returns

Promise\<object>

fileUri
fileUri: string;

getImageBytes()

getImageBytes(args): Promise<object>

This method generates a JPG from the loaded or scanned page and returns it as a base64 encoded string.

Parameters

ParameterType
argsobject
args.pageNumbernumber
args.pageSourceTypePageSourceType

Returns

Promise\<object>

bytes
bytes: string;

pageCount()

pageCount(): Promise<object>

This method returns the page count of the currently loaded document.

Returns

Promise\<object>

count
count: number;