UNPKG

@docutain/cordova-plugin-docutain-sdk

Version:

Cordova plugin of the Docutain Document Scanner SDK for Android and iOS. High quality document scanning, data extraction, text recognition and PDF creation for your apps. Easily scan documents in your app.

123 lines (122 loc) 4.71 kB
/** * Docutain SDK Cordova * Copyright (c) INFOSOFT Informations- und Dokumentationssysteme GmbH. All rights reserved. * * Docutain SDK Cordova is a commercial product and requires a license. * Details found in the LICENSE file in the root directory of this source tree. */ import type { DocumentScannerConfiguration, AnalyzeConfiguration, LogLevel, PageSourceType, PDFPageFormat, PhotoPaymentConfiguration, DocutainListItem } from './model'; export interface DocutainSDKPlugin { /** * Initializes the Docutain SDK. * This method needs to be called prior to using any functionality of the Docutain SDK. * @param licenseKey your Docutain SDK license key. */ initSDK(licenseKey: string): Promise<void>; /** * Starts the document scanner. * @param config an instance of DocumentScannerConfiguration. */ scanDocument(config: DocumentScannerConfiguration): Promise<{ status: string; }>; /** * Loads a file from the given path. * @param filePath the path pointing to the file to be loaded. */ loadFile(filepath: string): Promise<void>; /** * Detects the text of the currently loaded document and returns it. */ getText(): Promise<string>; /** * Detects the text of the currently loaded document and returns it. * * @param pageNumber number of the page you want the text from or leave empty to get text of entire document */ getTextPage(pageNumber: number): Promise<string>; /** * This method sets the analyze configuration. * * @param config An instance of AnalyzeConfiguration. */ setAnalyzeConfiguration(config: AnalyzeConfiguration): Promise<void>; /** * Analyzes the currently loaded document and returns the detected data. */ analyze(): Promise<string>; /** * This method generates a PDF document from the loaded or scanned pages. * * @param pageFormat the PDF page format, refer to PDFPageFormat. * @param fileUri the file uri where to save the PDF document. * @param overwrite if file already exist, indicate whether to override it or to append number, e.g. TestPDF(1).pdf. */ writePDF(pageFormat: PDFPageFormat, fileUri?: string, overWrite?: boolean): Promise<{ fileUri: string; }>; /** * This method sets the log level, which determines the severity of the message. * * @param logLevel The Level determining which kind of messages should be logged. The default is Level.Verbose. * */ setLogLevel(logLevel: LogLevel): Promise<void>; /** * This method returns the Trace file which includes logging and error messages. */ getTraceFile(): Promise<string>; /** * This method deletes all temporary files created by the Docutain SDK. * * @param deleteTraceFileContent If true, the content of the Trace file which you can send us in order to solve any problems will also be deleted */ deleteTempFiles(deleteTraceFileContent: boolean): Promise<void>; /** * This method generates a JPG from the loaded or scanned page and saves it to a local file. * * @param pageNumber the page to be generated as JPG * @param fileUri the file uri where to save the JPG file */ writeImage(pageNumber: number, fileUri: string): Promise<{ fileUri: string; }>; /** * This method generates a JPG from the loaded or scanned page and returns it as a base64 encoded string. * * @param pageNumber the page to be generated as JPG * @param pageSourceType the PageSourceType type to be used when generating the JPG */ getImageBytes(pageNumber: number, pageSourceType: PageSourceType): Promise<{ bytes: string; }>; /** * This method returns the page count of the currently loaded document. */ pageCount(): Promise<{ count: number; }>; /** * Resets onboarding state. * @param onboarding Opens onboarding on next start * @param scanHintPopup Opens scanHintPopup on next start. */ resetOnboarding(onboarding: boolean, scanHintPopup: boolean): Promise<void>; /** * Gets the default onboarding items. */ onboardingDefaultItems(): Promise<DocutainListItem[]>; /** * Gets the default scan tips items. */ scanTipsDefaultItems(): Promise<DocutainListItem[]>; /** * Starts the photo payment process. * @param config an instance of PhotoPaymentConfiguration. */ startPhotoPayment(config: PhotoPaymentConfiguration): Promise<string>; /** * Gets the default empty result screen items. */ emptyResultScreenDefaultItems(): Promise<DocutainListItem[]>; }