@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.
420 lines • 14.2 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.
*/
/**
* Available PDF page formats when generating PDF documents.
*/
export type PDFPageFormat = 'FIT_TO_PAGES' | 'A4' | 'A4_LANDSCAPE' | 'A5' | 'A5_LANDSCAPE' | 'LETTER' | 'LETTER_LANDSCAPE' | 'LEGAL' | 'LEGAL_LANDSCAPE';
/**
* Logs can be filtered based on their priority.
*/
export type LogLevel = 'DISABLE' | 'ASSERT' | 'ERROR' | 'WARNING' | 'INFO' | 'DEBUG' | 'VERBOSE';
/**
* Available filters that can be applied on scanned documents.
*/
export type ScanFilter = 'AUTO' | 'GRAY' | 'BLACKWHITE' | 'ORIGINAL' | 'TEXT' | 'AUTO2' | 'ILLUSTRATION';
/**
* Available sources for the document scanner.
*/
export type Source =
/**
* Scan a document by using the devices camera.
*/
'CAMERA'
/**
* Scan a document from the provided image.
*/
| 'IMAGE'
/**
* Open an image picker in single selection mode and scan a document from the selected image.
*/
| 'GALLERY'
/**
* Open an image picker in multi selection mode and scan a document from the selected images.
*/
| 'GALLERY_MULTIPLE';
/**
* Available page source types when generating image files from scanned or imported pages.
*/
export type PageSourceType =
/**
* Uncut, unfiltered image as delivered by camera.
*/
'ORIGINAL'
/**
* Cut and filtered image.
*/
| 'CUT_FILTER'
/**
* Cut only image, no filter.
*/
| 'CUT_ONLY';
/**
* A configuration class used to alter the default document analysis behaviour.
*/
export interface AnalyzeConfiguration {
/**
* Read BIC.
*/
readBIC?: boolean;
/**
* Read payment state.
*/
readPaymentState?: boolean;
}
/**
* A configuration class used to alter the default page editing behaviour.
*/
export interface PageEditConfiguration {
/**
* If false, the bottom toolbar will hide the filter page item. Defaults to true.
*/
allowPageFilter?: boolean;
/**
* If false, the bottom toolbar will hide the rotate page item. Defaults to true.
*/
allowPageRotation?: boolean;
/**
* If false, the bottom toolbar will hide the arrange page item. Defaults to true.
*/
allowPageArrangement?: boolean;
/**
* If false, the bottom toolbar will hide the page cropping item. Defaults to true.
*/
allowPageCropping?: boolean;
/**
* If true, the bottom toolbar will show a button allowing to retake the current page. Defaults to false.
*/
allowPageRetake?: boolean;
/**
* If true, each item of the page arrangement functionality will show a delete button.
* Defaults to false.
*/
pageArrangementShowDeleteButton?: boolean;
/**
* If true, each item of the page arrangement functionality will show it's page number.
* Defaults to true.
*/
pageArrangementShowPageNumber?: boolean;
}
export interface DocutainColor {
Light: string;
Dark: string;
}
/**
* A configuration class used to alter the default color theming behaviour.
*/
export interface ColorConfig {
/**
* is used to tint progress indicators and dialog buttons
*/
ColorPrimary?: DocutainColor;
/**
* is used to tint selectable controls and the capture button.
*/
ColorSecondary?: DocutainColor;
/**
* is used to tint elements that reside on docutain_colorSecondary, like the icon of the capture button.
*/
ColorOnSecondary?: DocutainColor;
/**
* is used to tint the background of the layout containing the buttons of the scan layout, like the capture button or torch button.
*/
ColorScanButtonsLayoutBackground?: DocutainColor;
/**
* is used to tint the foreground of the buttons of the scan layout, like the torch button.
*/
ColorScanButtonsForeground?: DocutainColor;
/**
* is used to tint the polygon overlay which highlights the currently detected document.
*/
ColorScanPolygon?: DocutainColor;
/**
* is used to tint the bottom toolbar background of the image editing page.
*/
ColorBottomBarBackground?: DocutainColor;
/**
* is used to tint the buttons within the bottom toolbar of the image editing page.
*/
ColorBottomBarForeground?: DocutainColor;
/**
* is used to tint the top toolbar background.
*/
ColorTopBarBackground?: DocutainColor;
/**
* is used to tint the elements contained in the top toolbar, like buttons and titles.
*/
ColorTopBarForeground?: DocutainColor;
}
/**
* A configuration class used to alter the default text behaviour.
*/
export interface TextConfiguration {
/**
* The text size of elements residing in the bottom toolbar. Defaults to 10dp.
*/
textSizeBottomToolbar?: number;
/**
* The text size of menu items residing in the top toolbar.
*/
textSizeTopToolbar?: number;
/**
* The text size of the buttons in the scan page, located at the lower part, like the torch button.
*/
textSizeScanButtons?: number;
/**
* The text size of the title in the top toolbar. By default, auto shrinking down till 9.0 is enabled.
* If you define your custom size, automatic shrinking will be disabled.
*/
textSizeTitle?: number;
/**
* The title to be displayed in the scan page top toolbar.
*/
textTitleScanPage?: string;
/**
* The title to be displayed in the edit page top toolbar.
*/
textTitleEditPage?: string;
/**
* The title to be displayed in the filter page top toolbar.
*/
textTitleFilterPage?: string;
/**
* The title to be displayed in the cropping page top toolbar.
*/
textTitleCroppingPage?: string;
/**
* The title to be displayed in the page arrangement page top toolbar.
*/
textTitleArrangementPage?: string;
/**
* The title to be displayed in the confirmation page top toolbar.
*/
textTitleConfirmationPage?: string;
/**
* The title to show in the top toolbar on all pages. It overwrites page specific titles, if any are set.
*/
textDocumentTitle?: string;
/**
* The text to show in the onboarding popup title that appears when the scan page is opened for the first time.
*/
textOnboardingTitle?: string;
/**
* The text to show in the onboarding popup message that appears when the scan page is opened for the first time.
*/
textOnboardingMessage?: string;
/**
* The text to show in the onboarding popup close button that appears when the scan page is opened for the first time.
*/
textOnboardingCloseButton?: string;
/**
* The text size of the onboarding popup title that appears when the scan page is opened for the first time.
*/
textSizeOnboardingTitle?: number;
/**
* The text size of the onboarding popup message that appears when the scan page is opened for the first time.
*/
textSizeOnboardingMessage?: number;
/**
* The text to show when camera is focusing after capture got triggered.
*/
textFocusHint?: string;
/**
* The text to show when user swipes to previous page but is already at the first page.
*/
textFirstPageHint?: string;
/**
* The text to show when user swipes to next page but is already at the last page.
*/
textLastPageHint?: string;
/**
* The text to show when user swipes to next or previous page but only one page is available.
*/
textOnePageHint?: string;
/**
* The text to show in the progress popup that is shown when user clicks the done button but
* some pages still need to be processed.
*/
textScanProgress?: string;
/**
* The text to show for the option to delete the current page within the dialog that will be
* shown when clicking delete while multiple pages are available.
*/
textDeleteDialogCurrentPage?: string;
/**
* The text to show for the option to delete all pages within the dialog that will be
* shown when clicking delete while multiple pages are available.
*/
textDeleteDialogAllPages?: string;
/**
* The text to show for the option to cancel within the dialog that will be
* shown when clicking delete while multiple pages are available.
*/
textDeleteDialogCancel?: string;
}
/**
* A generic button element used for the ready to use UI elements.
*/
export interface DocutainButton {
/**
* The title to show for the button.
*/
title?: string;
/**
* The icon to show for the button.
*/
icon?: string;
}
/**
* A configuration class used to alter the default buttons.
*/
export interface ButtonConfiguration {
/**
* The button that rotates the current page.
*/
buttonEditRotate?: DocutainButton;
/**
* The button that opens the cropping functionality.
*/
buttonEditCrop?: DocutainButton;
/**
* The button that opens the filter functionality.
*/
buttonEditFilter?: DocutainButton;
/**
* The button that opens the page arrangement functionality.
*/
buttonEditArrange?: DocutainButton;
/**
* The button that starts the process of replacing the current page with a new scan.
*/
buttonEditRetake?: DocutainButton;
/**
* The button that deletes the current page or opens a dialog with options if multiple pages
* are available.
*/
buttonEditDelete?: DocutainButton;
/**
* The button that finishes the scan process.
*/
buttonEditFinish?: DocutainButton;
/**
* The button within the cropping functionality that expands the current cropping rectangle
* to the whole page.
*/
buttonCropExpand?: DocutainButton;
/**
* The button within the cropping functionality that snaps the current cropping rectangle
* to the detected document.
*/
buttonCropSnap?: DocutainButton;
/**
* The button within the cropping functionality that finishes the manual cropping process
* according to the current cropping rectangle.
*/
buttonCropFinish?: DocutainButton;
/**
* The button within the scan functionality that is shown when automatic capture is activated.
*/
buttonScanAutoCaptureOn?: DocutainButton;
/**
* The button within the scan functionality that is shown when automatic capture is deactivated.
*/
buttonScanAutoCaptureOff?: DocutainButton;
/**
* The button within the scan functionality that toggles the torch.
*/
buttonScanTorch?: DocutainButton;
/**
* The button within the scan functionality that triggers a manual image capture.
*/
buttonScanCapture?: DocutainButton;
/**
* The button within the scan functionality that finishes the current scan process and leads
* to the editing page.
*/
buttonScanFinish?: DocutainButton;
/**
* The button on the confirmation page that finishes the scan process.
* See [DocumentScannerConfiguration.confirmPages].
*/
buttonConfirmationFinish?: DocutainButton;
}
/**
* A configuration class used to alter the default scan behaviour.
*/
export interface DocumentScannerConfiguration {
/**
* If true, the toolbar will display an Item allowing the user to switch between auto capture and manual capture. Defaults to false.
*/
allowCaptureModeSetting?: boolean;
/**
* If true, the camera will capture the image automatically at the right moment. Defaults to true.
*/
autoCapture?: boolean;
/**
* The default scan filter that will be used after scan. Defaults to [ScanFilter.ILLUSTRATION]. See [ScanFilter] for possible values.
*/
defaultScanFilter?: ScanFilter;
/**
* Your custom image for the onboarding dialog that appears when scan is opened for the first time.
*/
onboardingImageSource?: string;
/**
* Configuration class used to alter the default page editing behaviour.
*/
pageEditConfig?: PageEditConfiguration;
/**
* Configuration class used to alter the default color theming behaviour.
*/
colorConfig?: ColorConfig;
/**
* Select the source for the document scanner. Defaults to [Source.CAMERA]. See [Source] for possible values.
*/
source?: Source;
/**
* The source images for the document scanner if you have set the [source] to [Source.IMAGE].
*/
sourceImages?: string[];
/**
* If true, image gets automatically cropped if document was detected. This applies only if
* [source] is [Source.IMAGE] or [Source.GALLERY] or [Source.GALLERY_MULTIPLE]. Defaults to true.
*/
autoCrop?: Boolean;
/**
* If true, scanning multi page documents is possible. Set this to false if you need to scan single page documents. Defaults to true.
*
*/
multiPage?: Boolean;
/**
* If true, the camera will run a focus action right before taking the image. This improves the quality
* of the scanned images, but depending on the device, image capture might take a little bit longer.
* Defaults to true.
*/
preCaptureFocus?: Boolean;
/**
* Configuration class used to alter the default text behaviour.
*/
textConfig?: TextConfiguration;
/**
* Configuration class used to alter the default buttons.
*/
buttonConfig?: ButtonConfiguration;
/**
* If true, a list of all pages (thumbnails) will be displayed before the scan process can be finished.
* Defaults to false.
*/
confirmPages?: Boolean;
/**
* If true, after the scan screen is finished, an editing screen with the captured images will be displayed.
* On the editing screen, the user can crop manually, rotate the page, filter the page and much more.
* The editing screen can be configured by accessing the [pageEditConfig].
* Defaults to true.
*/
allowPageEditing?: Boolean;
}
//# sourceMappingURL=model.d.ts.map