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
Parameter | Type |
---|---|
args | object |
args.licenseKey | string |
Returns
Promise
\<void
>
scanDocument()
scanDocument(args): Promise<object>
Starts the document scanner.
Parameters
Parameter | Type |
---|---|
args | object |
args.config | DocumentScannerConfiguration |
Returns
Promise
\<object
>
status
status: string;
loadFile()
loadFile(args): Promise<void>
Parameters
Parameter | Type |
---|---|
args | object |
args.filepath | string |
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
Parameter | Type |
---|---|
args | object |
args.pageNumber | number |
Returns
Promise
\<object
>
text
text: string;
setAnalyzeConfiguration()
setAnalyzeConfiguration(args): Promise<void>
This method sets the analyze configuration.
Parameters
Parameter | Type |
---|---|
args | object |
args.config | AnalyzeConfiguration |
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
Parameter | Type | Description |
---|---|---|
args | object | |
args.fileUri | string | the file path where to save the PDF document. |
args.overWrite | boolean | if file already exist, indicate whether to override it or to append number, e.g. TestPDF(1).pdf. |
args.pageFormat | PDFPageFormat | the PDF page format, refer to PDFPageFormat. |
args.maxSizeKB ? | number | the 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
Parameter | Type |
---|---|
args | object |
args.logLevel | LogLevel |
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
Parameter | Type |
---|---|
args | object |
args.deleteTraceFileContent | boolean |
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
Parameter | Type |
---|---|
args | object |
args.pageNumber | number |
args.fileUri | string |
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
Parameter | Type |
---|---|
args | object |
args.pageNumber | number |
args.pageSourceType | PageSourceType |
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;