UNPKG

react-native-scanbot-sdk

Version:

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

247 lines (225 loc) 7.31 kB
import { DocumentsModelRootType } from './documents/DocumentsModel'; import { CustomBinarizationFilter, ScanbotBinarizationFilter } from './document/ParametricFilters'; import { AustraliaPostCustomerFormat, BarcodeDocumentFormat, BarcodeFormat, EngineMode, Gs1HandlingMode, MSIPlesseyChecksumAlgorithm, PageDirection, PageSize, } from './types'; export interface DetectBarcodesOnImageArguments { /** * The input image file URI */ imageFileUri: string; /** * Accepted barcode formats */ barcodeFormats?: BarcodeFormat[]; /** * An optional array of barcode document formats that act as a detection filter. * By default all supported document formats will be detected. */ acceptedDocumentFormats?: BarcodeDocumentFormat[]; /** * Barcode scanner engine mode. Default is NEXT_GEN */ engineMode?: EngineMode; /** * Optional minimum required text length of the detected barcode. * The default is 0 (setting is turned off). * NOTE: This feature works on ITF barcodes only. */ minimumTextLength?: number; /** * Optional maximum required text length of the detected barcode. * The default is 0 (setting is turned off). * NOTE: This feature works on ITF barcodes only. */ maximumTextLength?: number; /** * Optional minimum required quiet zone on the barcode. * Measured in modules (the size of minimal bar on the barcode). * The default is 10. * NOTE: This feature works on ITF barcodes only. */ minimum1DBarcodesQuietZone?: number; /** * With this option enabled, the scanner removes checks digits for UPC, EAN and MSI Plessey codes. * Has no effect if both single and double digit MSI Plessey checksums are enabled. * The default is `false` */ stripCheckDigits?: boolean; /** * The GS1 handling mode. The default value is PARSE. */ gs1HandlingMode?: Gs1HandlingMode; /** * The checksum algorithm for MSI Plessey barcodes. * The default value is Mod10. */ msiPlesseyChecksumAlgorithm?: MSIPlesseyChecksumAlgorithm; /** * If `true`, enabled the mode which slightly decreases the scanning quality and the energy consumption, and increases the scanning speed. If `false` - mode is disabled. The default is `false`. Android only. * */ lowPowerMode?: boolean; /** * If true, an additional quiet zone is added to the input image * The default is `false`. */ addAdditionalQuietZone?: boolean; /** * The customer format used in AUSTRALIA_POST codes. Only relevant for format codes 59 and 62. * The default value is `ALPHA_NUMERIC`. */ australiaPostCustomerFormat?: AustraliaPostCustomerFormat; /** * If `true`, the optional check digit for IATA_2_OF_5 codes is used in validation. * The default is `true`. */ useIATA2OF5Checksum?: boolean; /** * If `true`, the optional check digit for CODE_11 codes is used in validation. * The default is `true`. */ useCode11Checksum?: boolean; } interface PdfExtractorArguments { /** * The location of the PDF file */ pdfFilePath: string; /** * ( iOS only ) * The quality that each extracted image should have. * This tweaks the compression, affecting the final image file size. * (100: maximum quality, 0: minimum quality) * * Default value is 90 */ quality?: number; /** * ( iOS only ) * Integer scaling factor applied to the PDF media box frame while extracting. * Affects the output image quality. * In most cases the recommended value is 2 or higher. * * Default value is 2. */ scaling?: number; } export interface DocumentQualityAnalyzerArguments { imageFileUri: string; imageSizeLimit?: number; minimumNumberOfSymbols?: number; } export interface RecognizeMedicalCertificateArguments { imageFileUri: string; options?: { patientInfoRecognitionEnabled?: boolean; barcodeRecognitionEnabled?: boolean; detectDocumentEnabled?: boolean; returnCroppedDocumentUri?: boolean; }; } export interface RecognizeGenericDocumentArguments { imageFileUri: string; acceptedDocumentFormats?: DocumentsModelRootType[]; } export interface PerformOCRArguments { imageFileUris: string[]; ocrConfiguration?: OCRConfiguration; } export interface CreatePDFArguments { imageFileUris: string[]; options?: CreatePDFOptions; encryptedImageFiles?: boolean; } export interface CreatePDFOptions { pageSize?: PageSize; pageDirection?: PageDirection; metadata?: PDFMetadata; pageFitMode?: PDFPageFitMode; dpi?: number; jpegQuality?: number; resample?: boolean; ocrConfiguration?: OCRConfiguration; } export interface WriteTIFFArguments { imageFileUris: string[]; options?: WriteTiffOptions; } export interface WriteTiffOptions { binarizationFilter?: CustomBinarizationFilter | ScanbotBinarizationFilter; dpi?: number; compression?: TIFFCompression; userDefinedFields?: TIFFUserDefinedField[]; } export type CreateTIFFOptions = WriteTiffOptions; export type OCRConfiguration = OCRScanbotEngineConfiguration | OCRTesseractConfiguration; /** Slow but powerful OCR engine. Supports non-Latin languages. */ export type OCRTesseractConfiguration = { engineMode: 'TESSERACT'; languages: string[]; }; /** Fast and accurate OCR engine. Supports only Latin languages. */ export type OCRScanbotEngineConfiguration = { engineMode: 'SCANBOT_OCR'; }; export interface PDFMetadata { author?: string; creator?: string; title?: string; subject?: string; keywords?: string; } export type PDFPageFitMode = /** Fit image into page, preserves aspect ratio. */ | 'FIT_IN' /** Fill page with image, preserves aspect ratio. */ | 'FILL_IN' /** Stretch image to fill page, does NOT preserve aspect ratio. */ | 'STRETCH' /** No resizing, centers the image. */ | 'NONE'; /** TIFF Compression algorithms. */ export type TIFFCompression = /** Supported with binarized images. Supported with colored images. */ | 'NONE' /** Supported with binarized images. Is not supported with colored images. */ | 'CCITTRLE' /** Supported with binarized images. Is not supported with colored images. */ | 'CCITT_T4' /** Supported with binarized images. Is not supported with colored images. */ | 'CCITT_T6' /** Supported with binarized images. Supported with colored images. */ | 'LZW' /** Supported with binarized images. Is not supported with colored images. */ | 'CCITTRLEW' /** Supported with binarized images. Supported with colored images. */ | 'PACKBITS' /** Supported with binarized images. Supported with colored images. */ | 'DEFLATE' /** Supported with binarized images. Supported with colored images. */ | 'ADOBE_DEFLATE'; /** Class used to describe user-defined TIFF field. */ export interface TIFFUserDefinedField { /** Value of the field. */ fieldValue: string | number; /** Field name. */ fieldName: string; /** Field numeric tag. */ fieldTag: number; /** Field type. */ fieldType: TIFFUserDefinedFieldType; } export type TIFFUserDefinedFieldType = /** A numeric field type. */ | 'NUMERIC' /** A string based field type. */ | 'STRING'; export interface ExtractImagesFromPdfArguments extends PdfExtractorArguments {} export interface ExtractPagesFromPdfArguments extends PdfExtractorArguments {}