@docutain/react-native-docutain-sdk
Version:
React Native 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.
144 lines • 5.95 kB
TypeScript
/**
* Docutain SDK React Native
* Copyright (c) INFOSOFT Informations- und Dokumentationssysteme GmbH. All rights reserved.
*
* Docutain SDK React Native is a commercial product and requires a license.
* Details found in the LICENSE file in the root directory of this source tree.
*/
/// <reference types="react-native" />
import type { DocumentScannerConfiguration, AnalyzeConfiguration, PDFPageFormat, LogLevel, PageSourceType, DocutainListItem, PhotoPaymentConfiguration } from './model';
import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
export * from './model';
/**
* Main class of the Docutain SDK.
*/
export interface DocutainSDK {
/**
* 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.
* @return true if initialization was successful, false otherwise. Use getLastError() to retrieve error message.
*/
initSDK(licenseKey: string): Promise<boolean>;
/**
* Starts the document scanner.
* @param options an instance of @see {@link DocumentScannerConfiguration}.
*/
scanDocument(options: DocumentScannerConfiguration): Promise<void>;
/**
* Loads a file from the given path.
* @param filePath the path pointing to the file to be loaded.
* @return true if load was succesful, false otherwise.
*/
loadFile(filePath: string): Promise<boolean>;
/**
* Detects the text of the currently loaded document and returns it.
*
* @return the detected text
*/
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
* @return the detected text
*/
getTextPage(pageNumber: Int32): Promise<string>;
/**
* This method sets the analyze configuration.
*
* @param config An instance of AnalyzeConfiguration.
* @return true if configuration was successful, false otherwise.
*/
setAnalyzeConfiguration(config: AnalyzeConfiguration): Promise<boolean>;
/**
* Analyzes the currently loaded document and returns the detected data.
*
* @return the detected data as JSON String
*/
analyze(): Promise<string>;
/**
* This method generates a PDF document from the loaded or scanned pages.
*
* @param filePath the file path 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.
* @param PDF_PageFormat the PDF page format, refer to PDFPageFormat.
* @return the file path if PDF document was generated successfully, null otherwise.
*/
writePDF(filePath: string, overWrite: boolean, PDF_PageFormat: PDFPageFormat): Promise<string>;
/**
* This method returns the latest error message, if any error occurred.
*
* @return the error message.
*/
getLastError(): Promise<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<boolean>;
/**
* This method returns the Trace file which includes logging and error messages.
*
* @return the path to the Trace file.
*/
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
*
* @return true if all files deleted successfully, false if an error occurred
*/
deleteTempFiles(deleteTraceFileContent: boolean): Promise<boolean>;
/**
* 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 filePath the file path where to save the JPG file
* @return the file path if JPG was generated successfully, null otherwise
*/
writeImage(pageNumber: Int32, filePath: string): Promise<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
* @return the base64 encoded string if JPG was generated successfully, null otherwise
*/
getImageBytes(pageNumber: Int32, pageSourceType: PageSourceType): Promise<string>;
/**
* This method returns the page count of the currently loaded document.
*
* @return page count of the currently loaded document.
*/
pageCount(): Promise<Int32>;
/**
* 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[]>;
}
declare const DocutainSDK: DocutainSDK;
export default DocutainSDK;
//# sourceMappingURL=index.d.ts.map