UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

497 lines 16 kB
import { NativeModules, Platform } from 'react-native'; import { ScanbotBarcodeCameraView } from './components/barcode-camera-view/ScanbotBarcodeCameraView'; import { ScanbotDocumentScannerView } from './components/document-scanner-view/ScanbotDocumentScannerView'; const LINKING_ERROR = `The package 'react-native-scanbot-sdk' doesn't seem to be linked. Make sure: \n\n` + Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n'; const ScanbotSDKImpl = NativeModules.RNScanbotSDK ? NativeModules.RNScanbotSDK : new Proxy({}, { get() { throw new Error(LINKING_ERROR); } }); const ScanbotSDKUIImpl = NativeModules.RNScanbotRTUUI ? NativeModules.RNScanbotRTUUI : new Proxy({}, { get() { throw new Error(LINKING_ERROR); } }); const ScanbotDocument = { /** * Create a new document. */ createDocument(params) { return ScanbotSDKImpl.createDocument(params); }, /** * Create a new document from legacy pages. */ createDocumentFromLegacyPages(params) { return ScanbotSDKImpl.createDocumentFromLegacyPages(params); }, /** * Create a new document from PDF file. */ createDocumentFromPDF(pdfUri) { return ScanbotSDKImpl.createDocumentFromPDF(pdfUri); }, /** * Check if a document with the given ID exists. */ documentExists(documentID) { return ScanbotSDKImpl.documentExists(documentID); }, /** * Load a document by its ID. */ loadDocument(documentID) { return ScanbotSDKImpl.loadDocument(documentID); }, /** * Gets all stored document IDs. */ storedDocumentIDs() { return ScanbotSDKImpl.storedDocumentIDs(); }, /** * Clone a document by its ID. */ cloneDocument(documentID) { return ScanbotSDKImpl.cloneDocument(documentID); }, /** * Delete a document by its ID. */ deleteDocument(documentID) { return ScanbotSDKImpl.deleteDocument(documentID); }, /** * Delete all documents. */ deleteAllDocuments() { return ScanbotSDKImpl.deleteAllDocuments(); }, /** * Creates a PDF for the given document. * Please check the extra options that are part of the input params to modify the created PDF file per your needs. */ createPDF(params) { return ScanbotSDKImpl.createPDFForDocument(params); }, /** * Creates a TIFF for the given document. * Please check the extra options that are part of the input params to modify the created TIFF file per your needs. */ createTIFF(params) { return ScanbotSDKImpl.createTIFFForDocument(params); }, /** * Add a new page to a document and return the updated document. */ addPage(params) { return ScanbotSDKImpl.addPage(params); }, /** * Move a page in a document and return the updated document. */ movePage(params) { return ScanbotSDKImpl.movePage(params); }, /** * Modify a page in a document and return the updated document. */ modifyPage(params) { return ScanbotSDKImpl.modifyPage(params); }, /** * Remove a page from a document. */ removePage(params) { return ScanbotSDKImpl.removePageFromDocument(params); }, /** * Remove all pages from a document in one batch operation. */ removeAllPages(documentID) { return ScanbotSDKImpl.removeAllPages(documentID); } }; const ScanbotSDKUI = { /** * Opens the Ready-To-Use UI Document Scanner screen with the desired configuration. * * @deprecated Use ***startDocumentScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startDocumentScanner(configuration) { return ScanbotSDKUIImpl.startDocumentScanner(configuration); }, /** * Forces the Ready-To-Use UI Document Scanner screen to close while it is running. * * @deprecated */ closeDocumentScanner() { return ScanbotSDKUIImpl.closeDocumentScanner(); }, /** * Opens the Ready-To-Use UI Finder Document Scanner screen with the desired configuration. * * @deprecated Use ***startDocumentScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startFinderDocumentScanner(configuration) { return ScanbotSDKUIImpl.startFinderDocumentScanner(configuration); }, /** * Forces the Ready-To-Use UI Finder Document Scanner screen to close while it is running. * * @deprecated */ closeFinderDocumentScanner() { return ScanbotSDKUIImpl.closeFinderDocumentScanner(); }, /** * Opens the Ready-To-Use UI Cropping screen with the desired configuration. * * @deprecated Use ***startCroppingScreen*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startCroppingScreen(page, configuration) { return ScanbotSDKUIImpl.startCroppingScreen(page, configuration); }, /** * Forces the Ready-To-Use UI Cropping screen to close while it is running. * * @deprecated */ closeCroppingScreen() { return ScanbotSDKUIImpl.closeCroppingScreen(); }, /** * Opens the Ready-To-Use UI MRZ Scanner screen with the desired configuration. */ startMrzScanner(configuration) { return ScanbotSDKUIImpl.startMrzScanner(configuration); }, /** * Forces the Ready-To-Use UI MRZ Scanner screen to close while it is running. */ closeMrzScanner() { return ScanbotSDKUIImpl.closeMrzScanner(); }, /** * Opens the Ready-To-Use UI Barcode Scanner screen with the desired configuration. * * @deprecated Use ***startBarcodeScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startBarcodeScanner(configuration) { return ScanbotSDKUIImpl.startBarcodeScanner(configuration); }, /** * Forces the Ready-To-Use UI Barcode Scanner screen to close while it is running. * * @deprecated */ closeBarcodeScanner() { return ScanbotSDKUIImpl.closeBarcodeScanner(); }, /** * Opens the Ready-To-Use UI Batch Barcode Scanner screen with the desired configuration. * * @deprecated Use ***startBarcodeScanner*** from ***'react-native-scanbot-sdk/ui_v2'*** instead. */ startBatchBarcodeScanner(configuration) { return ScanbotSDKUIImpl.startBatchBarcodeScanner(configuration); }, /** * Forces the Ready-To-Use UI Batch Barcode Scanner screen to close while it is running. * * @deprecated */ closeBatchBarcodeScanner() { return ScanbotSDKUIImpl.closeBatchBarcodeScanner(); }, /** * Opens the Ready-To-Use UI European Health Insurance Card Scanner screen with the desired configuration. * * @deprecated Use ***startGenericDocumentRecognizer*** instead and enable ***DE_HEALTH_INSURANCE_CARD_FRONT*** and ***EU_HEALTH_INSURANCE_CARD*** document formats. */ startEHICScanner(configuration) { return ScanbotSDKUIImpl.startEHICScanner(configuration); }, /** * Forces the Ready-To-Use UI European Health Insurance Card Scanner screen to close while it is running. * * @deprecated */ closeEHICScanner() { return ScanbotSDKUIImpl.closeEHICScanner(); }, /** * Opens the Ready-To-Use UI Text Data Scanner screen with the desired configuration. */ startTextDataScanner(configuration) { return ScanbotSDKUIImpl.startTextDataScanner(configuration); }, /** * Forces the Ready-To-Use UI Text Data Scanner screen to close while it is running. */ closeTextDataScanner() { return ScanbotSDKUIImpl.closeTextDataScanner(); }, /** * Opens the Ready-To-Use UI License Plate Scanner screen with the desired configuration. */ startLicensePlateScanner(configuration) { return ScanbotSDKUIImpl.startLicensePlateScanner(configuration); }, /** * Forces the Ready-To-Use UI License Plate Scanner screen to close while it is running. */ closeLicensePlateScanner() { return ScanbotSDKUIImpl.closeLicensePlateScanner(); }, /** * Opens the Ready-To-Use UI Medical Certificate Recognizer screen with the desired configuration. */ startMedicalCertificateRecognizer(configuration) { return ScanbotSDKUIImpl.startMedicalCertificateRecognizer(configuration); }, /** * Forces the Ready-To-Use UI Medical Certificate Recognizer screen to close while it is running. */ closeMedicalCertificateRecognizer() { return ScanbotSDKUIImpl.closeMedicalCertificateRecognizer(); }, /** * Opens the Ready-To-Use UI Generic Document Recognizer screen with the desired configuration. */ startGenericDocumentRecognizer(configuration) { return ScanbotSDKUIImpl.startGenericDocumentRecognizer(configuration); }, /** * Forces the Ready-To-Use UI Generic Document Recognizer screen to close while it is running. */ closeGenericDocumentRecognizer() { return ScanbotSDKUIImpl.closeGenericDocumentRecognizer(); }, /** * Opens the Ready-To-Use UI Check Recognizer screen with the desired configuration. */ startCheckRecognizer(configuration) { return ScanbotSDKUIImpl.startCheckRecognizer(configuration); }, /** * Forces the Ready-To-Use UI Check Recognizer screen to close while it is running. */ closeCheckRecognizer() { return ScanbotSDKUIImpl.closeCheckRecognizer(); }, /** * Opens the Ready-To-Use UI VIN Scanner screen with the desired configuration. */ startVinScanner(configuration) { return ScanbotSDKUIImpl.startVinScanner(configuration); }, /** * Forces the Ready-To-Use UI VIN Scanner screen to close while it is running. */ closeVinScanner() { return ScanbotSDKUIImpl.closeVinScanner(); } }; const ScanbotSDK = { UI: ScanbotSDKUI, Document: ScanbotDocument, /** * Initializes the Scanbot SDK with the preferred configuration. */ initializeSDK(config) { return ScanbotSDKImpl.initializeSDK(config); }, /** * Provides complete information about the current license status. */ getLicenseInfo() { return ScanbotSDKImpl.getLicenseInfo(); }, /** * Returns the available OCR configs. */ getOCRConfigs() { return ScanbotSDKImpl.getOCRConfigs(); }, /** * Removes all files generated by this plugin. */ cleanup() { return ScanbotSDKImpl.cleanup(); }, /** * Recreates the given pages to refresh the Image URIs. */ refreshImageUris(args) { return ScanbotSDKImpl.refreshImageUris(args); }, /** * Detects barcodes on the image represented by the file URI. The image file URI is part of the input arguments. */ detectBarcodesOnImage(args) { return ScanbotSDKImpl.detectBarcodesOnImage(args); }, /** * Applies the given filters to the given image, and returns its URI. */ applyImageFilters(imageFileUri, filters) { return ScanbotSDKImpl.applyImageFilters(imageFileUri, filters); }, /** * Applies the given filters to the given page. */ applyImageFiltersOnPage(page, filters) { return ScanbotSDKImpl.applyImageFiltersOnPage(page, filters); }, /** * Creates a page with the image located at the given URI. */ createPage(imageUri) { return ScanbotSDKImpl.createPage(imageUri); }, /** * Removes the given page from the storage. */ removePage(page) { return ScanbotSDKImpl.removePage(page); }, /** * Rotates the given page for the number of 90 degree counterclockwise rotations. Negative values will rotate clockwise. */ rotatePage(page, times) { return ScanbotSDKImpl.rotatePage(page, times); }, /** * Applies the given image to the desired page. */ setDocumentImage(page, imageUri) { return ScanbotSDKImpl.setDocumentImage(page, imageUri); }, /** * Detects document on the given image and returns the result. */ detectDocument(imageFileUri) { return ScanbotSDKImpl.detectDocument(imageFileUri); }, /** * Detects document on the given page and returns the result. */ detectDocumentOnPage(page) { return ScanbotSDKImpl.detectDocumentOnPage(page); }, /** * Extracts images from a PDF represented by the file URL. The PDF file URL is part of the input arguments. */ extractImagesFromPdf(args) { return ScanbotSDKImpl.extractImagesFromPdf(args); }, /** * Extracts images from a PDF represented by the file URL, creates pages from them and returns the created pages. * The PDF file URL is part of the input arguments. */ extractPagesFromPdf(args) { return ScanbotSDKImpl.extractPagesFromPdf(args); }, /** * Returns the BASE64 Image Data for the given image. */ getImageData(imageFileUri) { return ScanbotSDKImpl.getImageData(imageFileUri); }, /** * Rotates the given image by the specified degrees counterclockwise. Negative values will rotate clockwise. */ rotateImage(imageFileUri, degrees) { return ScanbotSDKImpl.rotateImage(imageFileUri, degrees); }, /** * Detects the quality of the document on a still image. */ documentQualityAnalyzer(args) { return ScanbotSDKImpl.documentQualityAnalyzer(args); }, /** * Recognizes a Check on the given image. * Set desired check standards or leave it empty/undefined to recognize all supported checks. */ recognizeCheck(args) { return ScanbotSDKImpl.recognizeCheck(args); }, /** * Recognizes an MRZ on the given image. */ recognizeMrz(imageFileUri) { return ScanbotSDKImpl.recognizeMrz(imageFileUri); }, /** * Recognizes a Medical Certificate on the given image. * Modify the result with extra options that are part of the input arguments. */ recognizeMedicalCertificate(args) { return ScanbotSDKImpl.recognizeMedicalCertificate(args); }, /** * Recognizes a European Health Insurance Card (EHIC) on the given image. * * @deprecated Use ***recognizeGenericDocument*** instead and enable ***DE_HEALTH_INSURANCE_CARD_FRONT*** and ***EU_HEALTH_INSURANCE_CARD*** document formats. */ recognizeEHIC(imageFileUri) { return ScanbotSDKImpl.recognizeEHIC(imageFileUri); }, /** * Recognizes a generic document on the given image. * Set the expected generic document formats or leave it empty/undefined to recognize all supported generic document formats. */ recognizeGenericDocument(args) { return ScanbotSDKImpl.recognizeGenericDocument(args); }, /** * Performs OCR on given images. Set preferred ***ocrConfiguration*** engine, or leave it undefined to use the default one which is ***OCRScanbotEngineConfiguration***. * If ***OCRTesseractConfiguration*** is used, the expected ***languages*** need to be set. */ performOCR(args) { return ScanbotSDKImpl.performOCR(args); }, /** * Creates a PDF using the given list of image file URIs. * Please check the extra options that are part of the input arguments to modify the created PDF file per your needs. */ createPDF(args) { return ScanbotSDKImpl.createPDF(args); }, /** * Creates a TIFF using the given list of image file URIs. * Please check the extra options that are part of the input arguments to modify the created TIFF file per your needs. */ writeTIFF(args) { return ScanbotSDKImpl.writeTIFF(args); } }; export default ScanbotSDK; export * from './arguments'; export * from './parameters'; export * from './configurations'; export * from './customTypes'; export * from './results'; export * from './types'; export { Point } from './utils'; export * from './components/barcode-camera-view/ScanbotBarcodeCameraViewProperties'; export * from './components/document-scanner-view/ScanbotDocumentScannerViewProperties'; export { ScanbotBarcodeCameraView, ScanbotDocumentScannerView }; export * from './documents/BarcodeDocumentModel'; export * from './documents/CheckDocumentModel'; export * from './documents/CommonFieldType'; export * from './documents/DocumentsModel'; export * from './documents/GenericDocument'; export * from './document/DocumentData'; export * from './document/DocumentDetectionStatus'; export * from './document/DocumentQuality'; export * from './document/PageData'; export * from './document/PageImageSource'; export * from './document/ParametricFilters'; //# sourceMappingURL=index.js.map