@docutain/capacitor-plugin-docutain-sdk
Version:
Capacitor 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.
1,676 lines (1,675 loc) • 40.9 kB
TypeScript
/**
* Docutain SDK Capacitor
* Copyright (c) INFOSOFT Informations- und Dokumentationssysteme GmbH. All rights reserved.
*
* Docutain SDK Capacitor is a commercial product and requires a license.
* Details found in the LICENSE file in the root directory of this source tree.
*/
/**
* Main class of the Docutain SDK.
*/
export interface DocutainSDKPlugin {
/**
*
* Initializes the Docutain SDK.
* This method needs to be called prior to using any functionality of the Docutain SDK.
*
* @since 1.0.0
*/
initSDK(options: InitSDKOptions): Promise<void>;
/**
* Starts the document scanner.
*
* @deprecated Use `startDocumentScanner()` to start the document scanner.
* @since 1.0.0
*/
scanDocument(args: {
config: DocumentScannerConfiguration;
}): Promise<ScanDocumentResult>;
/**
* Starts the document scanner.
*
* @since 6.0.0
*/
startDocumentScanner(options: StartDocumentScannerOptions): Promise<void>;
/**
* Loads a file from the given path.
*
* @since 1.0.0
*/
loadFile(options: LoadFileOptions): Promise<void>;
/**
* Detects the text of the currently loaded document and returns it.
*
* @since 1.0.0
*/
getText(): Promise<GetTextResult>;
/**
*
* Detects the text of the currently loaded document page and returns it.
*
* @since 1.0.0
*/
getTextPage(options: GetTextPageOptions): Promise<GetTextPageResult>;
/**
* This method sets the analyze configuration.
*
* @deprecated Use `setAnalyzeConfigurationDocScan()` to sets the analyze configuration.
* @since 1.0.0
*/
setAnalyzeConfiguration(args: {
config: AnalyzeConfiguration;
}): Promise<void>;
/**
* This method sets the analyze configuration.
*
* @since 1.0.0
*/
setAnalyzeConfigurationDocScan(options: AnalyzeConfigurationOptions): Promise<void>;
/**
* This method get the detected data.
*
* @since 1.0.0
*/
analyze(): Promise<AnalyzeResult>;
/**
* This method generates a PDF document from the loaded or scanned pages.
*
* @since 1.0.0
*/
writePDF(options: WritePDFOptions): Promise<WritePDFResult>;
/**
* This method sets the log level, which determines the severity of the message.
*
* @since 1.0.0
*/
setLogLevel(options: SetLogLevelOptions): Promise<void>;
/**
* This method returns the Trace file which includes logging and error messages.
*
* @since 1.0.0
*/
getTraceFile(): Promise<GetTraceFileResult>;
/**
* This method deletes all temporary files created by the Docutain SDK.
*
* @since 1.0.0
*/
deleteTempFiles(options: DeleteTempFilesOptions): Promise<void>;
/**
* This method generates a JPG from the loaded or scanned page and saves it to a local file.
*
* @since 1.0.0
*/
writeImage(options: WriteImageOptions): Promise<WriteImageResult>;
/**
* This method generates a JPG from the loaded or scanned page and returns it as a base64 encoded string.
*
* @since 1.0.0
*/
getImageBytes(options: GetImageBytesOptions): Promise<GetImageBytesResult>;
/**
* This method returns the page count of the currently loaded document.
*
* @since 1.0.0
*/
pageCount(): Promise<PageCountResult>;
/**
* Resets onboarding state.
*
* @since 1.0.0
*/
resetOnboarding(options: ResetOnboardingOptions): Promise<void>;
/**
* Gets the default onboarding items.
*
* @since 1.0.0
*/
onboardingDefaultItems(): Promise<OnboardingDefaultItemsResult>;
/**
* Gets the default scan tips items.
*
* @since 1.0.0
*/
scanTipsDefaultItems(): Promise<ScanTipsDefaultItemsResult>;
/**
* Starts the photo payment process.
*
* @since 1.0.0
*/
startPhotoPayment(options: StartPhotoPaymentOptions): Promise<StartPhotoPaymentResult>;
/**
* Gets the default empty result screen items.
*
* @since 1.0.0
*/
emptyResultScreenDefaultItems(): Promise<EmptyResultScreenDefaultItemsResult>;
}
/**
* Options for {@link initSDK}.
*
*
* @since 1.0.0
*/
export interface InitSDKOptions {
/**
* Your Docutain SDK license key.
*
* @since 1.0.0
*/
licenseKey: string;
}
/**
* Available PDF page formats when generating PDF documents.
*
* @since 1.0.0
*/
export declare enum PDFPageFormat {
/**
*
* @since 1.0.0
*/
FitToPages = "FIT_TO_PAGES",
/**
*
* @since 1.0.0
*/
A4 = "A4",
/**
*
* @since 1.0.0
*/
A4Landscape = "A4_LANDSCAPE",
/**
*
* @since 1.0.0
*/
A5 = "A5",
/**
*
* @since 1.0.0
*/
A5Landscape = "A5_LANDSCAPE",
/**
*
* @since 1.0.0
*/
Letter = "LETTER",
/**
*
* @since 1.0.0
*/
LetterLandscape = "LETTER_LANDSCAPE",
/**
*
* @since 1.0.0
*/
Legal = "LEGAL",
/**
*
* @since 1.0.0
*/
LegalLandscape = "LEGAL_LANDSCAPE"
}
/**
* Available filters that can be applied on scanned documents.
*
* @since 1.0.0
*/
export declare enum ScanFilter {
/**
*
* @since 1.0.0
*/
Auto = "AUTO",
/**
*
* @since 1.0.0
*/
Gray = "GRAY",
/**
*
* @since 1.0.0
*/
BlackWhite = "BLACKWHITE",
/**
*
* @since 1.0.0
*/
Original = "ORIGINAL",
/**
*
* @since 1.0.0
*/
Text = "TEXT",
/**
*
* @since 1.0.0
*/
Auto2 = "AUTO2",
/**
*
* @since 1.0.0
*/
Illustration = "ILLUSTRATION"
}
/**
* Available page source types when generating image files from scanned or imported pages.
*
* @since 1.0.0
*/
export declare enum PageSourceType {
/**
* Uncut, unfiltered image as delivered by camera.
*
* @since 1.0.0
*/
Original = "ORIGINAL",
/**
* Cut and filtered image.
*
* @since 1.0.0
*/
CutFilter = "CUT_FILTER",
/**
* Cut only image, no filter.
*
* @since 1.0.0
*/
CutOnly = "CUT_ONLY"
}
/**
* Available log level for defining the level of logging detail
*
* @since 1.0.0
*/
export declare enum LogLevel {
Disable = "DISABLE",
Assert = "ASSERT",
Error = "ERROR",
Warning = "WARNING",
Info = "INFO",
Debug = "DEBUG",
Verbose = "VERBOSE"
}
/**
* Available sources for the document scanner.
*
* @since 1.0.0
*/
export declare enum Source {
/**
* Scan a document by using the devices camera.
*
* @since 1.0.0
*/
Camera = "CAMERA",
/**
* Scan a document from the provided image.
*
* @since 1.0.0
*/
Image = "IMAGE",
/**
* Open an image picker in single selection mode and scan a document from the selected image.
*
* @since 1.0.0
*/
Gallery = "GALLERY",
/**
* Open an image picker in multi selection mode and scan documents from the selected images.
*
* @since 1.0.0
*/
GalleryMultiple = "GALLERY_MULTIPLE",
/**
* Same as [CAMERA] but shows an additional import button which the user can use to import files as well.
*
* @since 6.0.0
*/
CameraImport = "CAMERA_IMPORT"
}
/**
* Available statusbar appearances.
*
* @since 2.0.5
*/
export declare enum StatusBarAppearance {
/**
* Light appearance.
*
* @since 2.0.5
*/
Light = "LIGHT",
/**
* Dark appearance.
*
* @since 2.0.5
*/
Dark = "DARK"
}
/**
* Available navigationbar appearances.
*
* @since 2.0.5
*/
export declare enum NavigationBarAppearance {
/**
* Light appearance.
*
* @since 2.0.5
*/
Light = "LIGHT",
/**
* Dark appearance.
*
* @since 2.0.5
*/
Dark = "DARK"
}
/**
* A configuration class used to alter the default page editing behaviour.
*
* @since 1.0.0
*/
export interface PageEditConfiguration {
/**
* If false, the bottom toolbar will hide the filter page item. Defaults to true.
*
* @since 1.0.0
*/
allowPageFilter?: boolean;
/**
* If false, the bottom toolbar will hide the rotate page item. Defaults to true.
*
* @since 1.0.0
*/
allowPageRotation?: boolean;
/**
* If false, the bottom toolbar will hide the arrange page item. Defaults to true.
*
* @since 1.0.0
*/
allowPageArrangement?: boolean;
/**
* If false, the bottom toolbar will hide the page cropping item. Defaults to true.
*
* @since 1.0.0
*/
allowPageCropping?: boolean;
/**
* If true, the bottom toolbar will show a button allowing to retake the current page. Defaults to false.
*
* @since 2.0.1
*/
allowPageRetake?: boolean;
/**
* If true, the bottom toolbar will show a button allowing to add a new page.
* Defaults to false.
*
* @since 6.0.0
*/
allowPageAdd?: boolean;
/**
* If true, the menu item for deleting pages will be displayed in the toolbar.
* Defaults to true.
*
* @since 6.0.0
*/
allowPageDeletion?: boolean;
/**
* If true, each item of the page arrangement functionality will show a delete button.
* Defaults to false.
*
* @since 1.0.0
*/
pageArrangementShowDeleteButton?: boolean;
/**
* If true, each item of the page arrangement functionality will show it's page number.
* Defaults to true.
*
* @since 1.0.0
*/
pageArrangementShowPageNumber?: boolean;
}
/**
* A configuration class used to define color in light and dark mode.
*
* @since 1.0.0
*/
export interface DocutainColor {
/**
* Used color in light mode
*
* @since 1.0.0
*/
Light: string;
/**
* Used color in dark mode
*
* @since 1.0.0
*/
Dark: string;
}
/**
* A configuration class used to alter the default color theming behaviour.
*
* @since 1.0.0
*/
export interface ColorConfig {
/**
* is used to tint progress indicators and dialog buttons
*
* @since 1.0.0
*/
ColorPrimary?: DocutainColor;
/**
* is used to tint elements that reside on ColorPrimary, like the icon and text of primary buttons.
*
* @since 6.0.0
*/
ColorOnPrimary?: DocutainColor;
/**
* is used to tint selectable controls and the capture button.
*
* @since 1.0.0
*/
ColorSecondary?: DocutainColor;
/**
* is used to tint elements that reside on docutain_colorSecondary, like the icon of the capture button.
*
* @since 1.0.0
*/
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.
*
* @since 1.0.0
*/
ColorScanButtonsLayoutBackground?: DocutainColor;
/**
* is used to tint the foreground of the buttons of the scan layout, like the torch button.
*
* @since 1.0.0
*/
ColorScanButtonsForeground?: DocutainColor;
/**
* is used to tint the polygon overlay which highlights the currently detected document.
*
* @since 1.0.0
*/
ColorScanPolygon?: DocutainColor;
/**
* is used to tint the bottom toolbar background of the image editing page.
*
* @since 1.0.0
*/
ColorBottomBarBackground?: DocutainColor;
/**
* is used to tint the buttons within the bottom toolbar of the image editing page.
*
* @since 1.0.0
*/
ColorBottomBarForeground?: DocutainColor;
/**
* is used to tint the top toolbar background.
*
* @since 1.0.0
*/
ColorTopBarBackground?: DocutainColor;
/**
* is used to tint the elements contained in the top toolbar, like buttons and titles.
*
* @since 1.0.0
*/
ColorTopBarForeground?: DocutainColor;
/**
* is used to tint the text of the top toolbar title.
*
* @since 6.0.0
*/
ColorTopBarTitle?: DocutainColor;
}
/**
* A configuration class used to alter the default text behaviour.
*
* @since 2.0.1
*/
export interface TextConfiguration {
/**
* The text size of elements residing in the bottom toolbar. Defaults to 10dp.
*
* @since 2.0.1
*/
textSizeBottomToolbar?: number;
/**
* The text size of menu items residing in the top toolbar.
*
* @since 2.0.1
*/
textSizeTopToolbar?: number;
/**
* The text size of the buttons in the scan page, located at the lower part, like the torch button.
*
* @since 2.0.1
*/
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.
*
* @since 2.0.1
*/
textSizeTitle?: number;
/**
* The title to be displayed in the scan page top toolbar.
*
* @since 2.0.1
*/
textTitleScanPage?: string;
/**
* The title to be displayed in the edit page top toolbar.
*
* @since 2.0.1
*/
textTitleEditPage?: string;
/**
* The title to be displayed in the filter page top toolbar.
*
* @since 2.0.1
*/
textTitleFilterPage?: string;
/**
* The title to be displayed in the cropping page top toolbar.
*
* @since 2.0.1
*/
textTitleCroppingPage?: string;
/**
* The title to be displayed in the page arrangement page top toolbar.
*
* @since 2.0.1
*/
textTitleArrangementPage?: string;
/**
* The title to be displayed in the confirmation page top toolbar.
*
* @since 2.0.1
*/
textTitleConfirmationPage?: string;
/**
* The title to show in the top toolbar on all pages. It overwrites page specific titles, if any are set.
*
*
* @since 2.0.1
*/
textDocumentTitle?: string;
/**
* The text to show in the onboarding popup title that appears when the scan page is opened for the first time.
*
* @deprecated Use `onboarding.scanHintPopup.title'
* @since 2.0.1
*/
textOnboardingTitle?: string;
/**
* The text to show in the onboarding popup message that appears when the scan page is opened for the first time.
*
* @deprecated Use `onboarding.scanHintPopup.message`
* @since 2.0.1
*/
textOnboardingMessage?: string;
/**
* The text to show in the onboarding popup close button that appears when the scan page is opened for the first time.
*
* @deprecated Use `onboarding.scanHintPopup.closeButton`
* @since 2.0.1
*/
textOnboardingCloseButton?: string;
/**
* The text size of the onboarding popup title that appears when the scan page is opened for the first time.
*
* @deprecated removed.
* @since 2.0.1
*/
textSizeOnboardingTitle?: number;
/**
* The text size of the onboarding popup message that appears when the scan page is opened for the first time.
*
* @deprecated removed.
* @since 2.0.1
*/
textSizeOnboardingMessage?: number;
/**
* The text to show when camera is focusing after capture got triggered.
*
* @since 2.0.1
*/
textFocusHint?: string;
/**
* The text to show when user swipes to previous page but is already at the first page.
*
* @since 2.0.1
*/
textFirstPageHint?: string;
/**
* The text to show when user swipes to next page but is already at the last page.
*
* @since 2.0.1
*/
textLastPageHint?: string;
/**
* The text to show when user swipes to next or previous page but only one page is available.
*
* @since 2.0.1
*/
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.
*
* @since 2.0.1
*/
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.
*
* @since 2.0.1
*/
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.
*
* @since 2.0.1
*/
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.
*
* @since 2.0.1
*/
textDeleteDialogCancel?: string;
/**
* The title to be displayed in the scan tips page top toolbar.
*
* @since 6.0.0
*/
textTitleScanTipsPage?: string;
}
/**
* A generic button element used for the ready to use UI elements.
*
* @since 2.0.1
*/
export interface DocutainButton {
/**
* The title to show for the button.
*
* @since 2.0.1
*/
title?: string;
/**
* The icon to show for the button.
*
* @since 2.0.1
*/
icon?: string;
}
/**
* A generic list element used for the ready to use UI elements.
*
* @since 6.0.0
*/
export interface DocutainListItem {
/**
* The icon to show for the button.
*
* @since 6.0.0
*/
image?: string;
/**
* The title to show for the button.
*
* @since 6.0.0
*/
title?: string;
/**
* The title to show for the button.
*
* @since 6.0.0
*/
message?: string;
}
/**
* UI components that can be used to onboard the user.
*
* @since 6.0.0
*/
export interface Onboarding {
/**
* The items you want to show within the onboarding. See [DocutainListItem] for more details
* on what each item can display. You can use [defaultItems] if you don't want to provide your own.
* If you want to disable it, set it to null.
*
* @since 6.0.0
*/
items?: DocutainListItem[];
/**
* The button that goes to the next item.
*
* @since 6.0.0
*/
buttonNext?: DocutainButton;
/**
* The button that closes the onboarding on the last item.
*
* @since 6.0.0
*/
buttonFinish?: DocutainButton;
/**
* The button to skip (close) the onboarding.
*
* @since 6.0.0
*/
buttonSkip?: DocutainButton;
/**
* The button that goes to the previous item. It is disabled by default.
*
* @since 6.0.0
*/
buttonBack?: DocutainButton;
/**
* A popup that appears when scan is opened for the first time, explaining the user how to scan.
*
* @since 6.0.0
*/
scanHintPopup?: ScanHintPopup | null;
}
/**
* A popup within the scan screen which shows a short explanation about how to scan.
*
* @since 6.0.0
*/
export interface ScanHintPopup {
/**
* The text to display as title.
*
* @since 6.0.0
*/
title?: string;
/**
* The text to display as message.
*
* @since 6.0.0
*/
message?: string;
/**
* The text of the close button.
*
* @since 6.0.0
*/
closeButton?: string;
/**
* The image to display.
*
* @since 6.0.0
*/
imageSource?: string;
}
/**
* UI components that can be used to provide the user some scan tips.
*
* @since 6.0.0
*/
export interface ScanTips {
/**
* The items you want to show within the scan tips. See [DocutainListItem] for more details
* on what each item can display. If you don't provide any items, some [defaultItems] will be
* displayed.
*
* @since 6.0.0
*/
items?: DocutainListItem[];
/**
* The toolbar item that will be shown allowing the user to open the scan tips.
*
* @since 6.0.0
*/
toolbarItem?: DocutainButton;
}
/**
* A configuration class used to alter the default buttons.
*
* @since 2.0.1
*
*/
export interface ButtonConfiguration {
/**
* The button that rotates the current page.
*
* @since 2.0.1
*/
buttonEditRotate?: DocutainButton;
/**
* The button that opens the cropping functionality.
*
* @since 2.0.1
*/
buttonEditCrop?: DocutainButton;
/**
* The button that opens the filter functionality.
*
* @since 2.0.1
*/
buttonEditFilter?: DocutainButton;
/**
* The button that opens the page arrangement functionality.
*
* @since 2.0.1
*/
buttonEditArrange?: DocutainButton;
/**
* The button that starts the process of replacing the current page with a new scan.
*
* @since 2.0.1
*/
buttonEditRetake?: DocutainButton;
/**
* The button that deletes the current page or opens a dialog with options if multiple pages are available.
*
* @since 2.0.1
*/
buttonEditDelete?: DocutainButton;
/**
* The button that finishes the scan process.
*
* @since 2.0.1
*/
buttonEditFinish?: DocutainButton;
/**
* The button within the cropping functionality that expands the current cropping rectangle
* to the whole page.
*
* @since 2.0.1
*/
buttonCropExpand?: DocutainButton;
/**
* The button within the cropping functionality that snaps the current cropping rectangle
* to the detected document.
*
* @since 2.0.1
*/
buttonCropSnap?: DocutainButton;
/**
* The button within the cropping functionality that finishes the manual cropping process
* according to the current cropping rectangle.
*
* @since 2.0.1
*/
buttonCropFinish?: DocutainButton;
/**
* The button within the scan functionality that is shown when automatic capture is activated.
*
* @since 2.0.1
*/
buttonScanAutoCaptureOn?: DocutainButton;
/**
* The button within the scan functionality that is shown when automatic capture is deactivated.
*
* @since 2.0.1
*/
buttonScanAutoCaptureOff?: DocutainButton;
/**
* The button within the scan functionality that toggles the torch.
*
* @since 2.0.1
*/
buttonScanTorch?: DocutainButton;
/**
* The button within the scan functionality that triggers a manual image capture.
*
* @since 2.0.1
*/
buttonScanCapture?: DocutainButton;
/**
* The button within the scan functionality that finishes the current scan process and leads
* to the editing page.
*
* @since 2.0.1
*/
buttonScanFinish?: DocutainButton;
/**
* The button on the confirmation page that finishes the scan process.
* See [DocumentScannerConfiguration.confirmPages].
*
* @since 2.0.1
*/
buttonConfirmationFinish?: DocutainButton;
/**
* The button on the edit page that opens the scan screen to add a new page.
*
* @since 6.0.0
*/
buttonEditAddPage?: DocutainButton;
/**
* The button on the scan page that opens a file importer.
*
* @since 6.0.0
*/
buttonScanImport?: DocutainButton;
}
/**
* A configuration class used to alter the default scan behaviour.
*
* @since 6.0.0
*/
export interface StartDocumentScannerOptions {
/**
* If true, the toolbar will display an Item allowing the user to switch between auto capture and manual capture. Defaults to false.
*
* @since 1.0.0
*/
allowCaptureModeSetting?: boolean;
/**
* If true, the camera will capture the image automatically at the right moment. Defaults to true.
*
* @since 1.0.0
*/
autoCapture?: boolean;
/**
* The default scan filter that will be used after scan. Defaults to [ScanFilter.ILLUSTRATION]. See [ScanFilter] for possible values.
*
* @since 1.0.0
* @default ScanFilter.ILLUSTRATION
*/
defaultScanFilter?: ScanFilter;
/**
* Your custom image for the onboarding dialog that appears when scan is opened for the first time.
*
* @deprecated Use `onboarding.scanHintPopup.imageSource`
* @since 1.0.0
*/
onboardingImageSource?: string;
/**
* Configuration class used to alter the default page editing behaviour.
*
* @since 1.0.0
*/
pageEditConfig?: PageEditConfiguration;
/**
* Configuration class used to alter the default color theming behaviour.
*
* @since 1.0.0
*/
ColorConfig?: ColorConfig;
/**
* Select the source for the document scanner. Defaults to [Source.CAMERA]. See [Source] for possible values.
*
* @since 1.0.0
*/
source?: Source;
/**
* The source images for the document scanner if you have set the [source] to [Source.IMAGE].
*
* @since 1.0.0
*/
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].
*
* @since 1.0.0
*/
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.
*
* @since 1.0.0
*/
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.
*
* @since 1.0.0
*/
preCaptureFocus?: boolean;
/**
* Configuration class used to alter the default text behaviour.
*
* @since 2.0.1
*/
textConfig?: TextConfiguration;
/**
* Configuration class used to alter the default buttons.
*
* @since 2.0.1
*/
buttonConfig?: ButtonConfiguration;
/**
* If true, a list of all pages (thumbnails) will be displayed before the scan process can be finished.
* Defaults to false.
*
* @since 2.0.1
*/
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.
*
* @since 2.0.2
*/
allowPageEditing?: boolean;
/**
* Overrides the status bar appearance. By default, the system chooses the appearance based on the current UI Mode.
*
* Only available on Android.
*
* @since 2.0.5
*/
statusBarAppearance?: StatusBarAppearance;
/**
* Overrides the navigation bar appearance. By default, the system chooses the appearance based on the current UI Mode.
*
* Only available on Android.
*
* @since 2.0.5
*/
navigationBarAppearance?: NavigationBarAppearance;
/**
* If true, when an image is captured, the device vibrates to signal successful capture.
* Defaults to false.
*
* @since 6.0.0
*/
vibrateOnCapture?: boolean;
/**
* An optional onboarding when the user opens the scanner for the first time. See [Onboarding]
* for more details.
*
* @since 6.0.0
*/
onboarding?: Onboarding | null;
/**
* An optional toolbar item that shows scan tips when clicked. See [ScanTips] for more details.
*
* @since 6.0.0
*/
scanTips?: ScanTips | null;
}
/**
* The result of {@link scanDocument}.
*
* @since 1.0.0
*/
export interface ScanDocumentResult {
/**
* The scan document result
*
* @since 1.0.0
*/
status: string;
}
/**
* The result of {@link onboardingDefaultItems}.
*
* @since 1.0.0
*/
export interface OnboardingDefaultItemsResult {
/**
* The default items for onboarding
*
* @since 1.0.0
*/
items: DocutainListItem[];
}
/**
* The result of {@link scanTipsDefaultItems}.
*
* @since 1.0.0
*/
export interface ScanTipsDefaultItemsResult {
/**
* The default items for scan tips
*
* @since 1.0.0
*/
items: DocutainListItem[];
}
/**
* The result of {@link emptyResultScreenDefaultItems}.
*
* @since 1.0.0
*/
export interface EmptyResultScreenDefaultItemsResult {
/**
* The default items for the empty result screen
*
* @since 1.0.0
*/
items: DocutainListItem[];
}
/**
* Options for {@link loadFile}.
*
* @since 1.0.0
*/
export interface LoadFileOptions {
/**
* The path of the file.
*
* @since 1.0.0
*/
filepath: string;
}
/**
* Options for {@link getTextPage}.
*
* @since 1.0.0
*/
export interface GetTextPageOptions {
/**
* Number of the page you want the text from or leave empty to get text of entire document
*
* @since 1.0.0
*/
pageNumber?: number;
}
/**
* The result of {@link getText}.
*
* @since 1.0.0
*/
export interface GetTextResult {
/**
* The Text of entire document
*
* @since 1.0.0
*/
text: string;
}
/**
* The result of {@link getTextPage}.
*
* @since 1.0.0
*/
export interface GetTextPageResult {
/**
* The Text page you want the text from or the text of entire document, if you leave pageNumber empty
*
* @since 1.0.0
*/
text: string;
}
/**
* Options for {@link setAnalyzeConfigurationDocScan}.
*
* @since 1.0.0
*/
export interface AnalyzeConfigurationOptions {
/**
* Read BIC.
*
* @since 1.0.0
*/
readBIC?: boolean;
/**
* Read payment state.
*
* @since 1.0.0
*/
readPaymentState?: boolean;
/**
* Read SEPA Creditor.
*
* @since 1.0.0
*/
readSEPACreditor?: boolean;
}
/**
* The result of {@link analyze}.
*
* @since 1.0.0
*/
export interface AnalyzeResult {
/**
* The analyze result als json string.
*
* @since 1.0.0
*/
data: string;
}
/**
* Options for {@link writePDF}.
*
* @since 1.0.0
*/
export interface WritePDFOptions {
/**
* The file path where to save the PDF document.
*
* @since 1.0.0
*/
fileUri?: string;
/**
* if file already exist, indicate whether to override it or to append number.
*
* @example 'TestPDF(1).pdf'
* @since 1.0.0
*/
overWrite?: boolean;
/**
* The PDF page format, refer to PDFPageFormat.
*
* @since 1.0.0
*/
pageFormat?: PDFPageFormat;
/**
* the maximum file size in KB of the PDF or 0 if no compression should be applied.
* The PDF will only be compressed if the uncompressed PDF would exceed the max you have set.
* Please be aware, that if the PDF gets compressed, the quality decreases and the PDF generation will take longer.
*
* @since 2.0.1
*/
maxSizeKB?: number;
}
/**
* The result of {@link writePDF}.
*
* @since 1.0.0
*/
export interface WritePDFResult {
/**
* The file path to the PDF document.
*
* @example 'TestPDF(1).pdf'
* @since 1.0.0
*/
fileUri: string;
}
/**
* Options for {@link setLogLevel}.
*
* @since 1.0.0
*/
export interface SetLogLevelOptions {
/**
* The Level determining which kind of messages should be logged. The default is Level.Verbose.
*
* @since 1.0.0
* @default Level.Verbose
*/
logLevel: LogLevel;
}
/**
* The result of {@link getTraceFile}.
*
* @since 1.0.0
*/
export interface GetTraceFileResult {
/**
* The file path to the trace file.
*
* @since 1.0.0
*/
fileUri: string;
}
/**
* Options for {@link deleteTempFiles}.
*
* @since 1.0.0
*/
export interface DeleteTempFilesOptions {
/**
* If true, the content of the Trace file which you can send us in order to solve any problems will also be deleted
*
* @since 1.0.0
*/
deleteTraceFileContent: boolean;
}
/**
* Options for {@link writeImage}.
*
* @since 1.0.0
*/
export interface WriteImageOptions {
/**
* The page to be generated as JPG
*
* @since 1.0.0
*/
pageNumber: number;
/**
* The file uri where to save the JPG file
*
* @since 1.0.0
*/
fileUri: string;
}
/**
* The result of {@link writeImage}.
*
* @since 1.0.0
*/
export interface WriteImageResult {
/**
* The file uri of the saved the JPG file
*
* @since 1.0.0
*/
fileUri: string;
}
/**
* Options for {@link getImageBytes}.
*
* @since 1.0.0
*/
export interface GetImageBytesOptions {
/**
* The page to be generated as JPG
*
* @since 1.0.0
*/
pageNumber: number;
/**
* The PageSourceType type to be used when generating the JPG
*
* @since 1.0.0
*/
pageSourceType?: PageSourceType;
}
/**
* The result of {@link getImageBytes}.
*
* @since 1.0.0
*/
export interface GetImageBytesResult {
/**
* The blob of the saved the JPG file
*
* @since 1.0.0
*/
bytes: string;
}
/**
* The result of {@link pageCount}.
*
* @since 1.0.0
*/
export interface PageCountResult {
/**
* The count of pages for the document
*
* @since 1.0.0
*/
count: number;
}
/**
* Options for {@link resetOnboarding}.
*
* @since 1.0.0
*/
export interface ResetOnboardingOptions {
/**
* Opens onboarding on next start
*
* @since 1.0.0
*/
onboarding: boolean;
/**
* Opens scanHintPopup on next start.
*
* @since 1.0.0
*/
scanHintPopup: boolean;
}
/**
* A configuration class used to alter the default document analysis behaviour for payment.
*/
export interface PaymentAnalyzeConfiguration {
/**
* Read BIC.
*
* @default true
* @since 6.0.0
*/
readBIC?: boolean;
/**
* Read payment state.
*
* @default false
* @since 6.0.0
*/
readPaymentState?: boolean;
/**
* Read SEPA Creditor.
*
* @default true
* @since 6.0.0
*/
readSEPACreditor?: boolean;
}
/**
* A configuration class used to alter the default empty result screen.
*/
export interface EmptyResultScreen {
/**
* The items you want to show as scan tips. See [DocutainListItem] for more details
* on what each item can display. If you don't provide any items, some [defaultItems] will be
* displayed.
*
* @since 6.0.0
*/
items?: DocutainListItem[];
/**
* The title to be displayed in the top toolbar.
*
* @since 6.0.0
*/
title?: string;
/**
* The button that restarts the scan process.
*
* @since 6.0.0
*/
repeatButton?: DocutainButton;
}
/**
* A configuration class used to alter the default photo payment behaviour.
*/
export interface StartPhotoPaymentOptions {
/**
* If true, the toolbar will display an Item allowing the user to switch between auto capture and manual capture. Defaults to false.
*
* @default false
* @since 6.0.0
*/
allowCaptureModeSetting?: boolean;
/**
* If true, the camera will capture the image automatically at the right moment. Defaults to true.
*
* @default true
* @since 6.0.0
*/
autoCapture?: boolean;
/**
* The default scan filter that will be used after scan. Defaults to [ScanFilter.ILLUSTRATION]. See [ScanFilter] for possible values.
*
* @default ScanFilter.ILLUSTRATION
* @since 6.0.0
*/
defaultScanFilter?: ScanFilter;
/**
* Configuration class used to alter the default page editing behaviour.
*
* @since 6.0.0
*/
pageEditConfig?: PageEditConfiguration;
/**
* Configuration class used to alter the default color theming behaviour.
*
* @since 6.0.0
*/
ColorConfig?: ColorConfig;
/**
* Select the source for the document scanner. Defaults to [Source.CAMERA]. See [Source] for possible values.
*
* @default Source.CAMERA
* @since 6.0.0
*/
source?: Source;
/**
* The source images for the document scanner if you have set the [source] to [Source.IMAGE].
*
* @since 6.0.0
*/
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.
*
* @default true
* @since 6.0.0
*/
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.
*
* @default true
* @since 6.0.0
*/
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.
*
* @default true
* @since 6.0.0
*/
preCaptureFocus?: boolean;
/**
* Configuration class used to alter the default text behaviour.
*
* @default true
* @since 6.0.0
*/
textConfig?: TextConfiguration;
/**
* Configuration class used to alter the default buttons.
*
* @since 6.0.0
*/
buttonConfig?: ButtonConfiguration;
/**
* If true, a list of all pages (thumbnails) will be displayed before the scan process can be finished.
* Defaults to false.
*
* @default false
* @since 6.0.0
*/
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.
*
* @default true
* @since 6.0.0
*/
allowPageEditing?: boolean;
/**
* Overrides the status bar appearance. By default, the system chooses the appearance based on the current UI Mode.
*
* Only available on Android.
*
* @since 6.0.0
*/
statusBarAppearance?: StatusBarAppearance;
/**
* Overrides the navigation bar appearance. By default, the system chooses the appearance based on the current UI Mode.
*
* Only available on Android.
*
* @since 6.0.0
*/
navigationBarAppearance?: NavigationBarAppearance;
/**
* If true, when an image is captured, the device vibrates to signal successful capture.
* Defaults to false.
*/
vibrateOnCapture?: boolean;
/**
* An optional onboarding when the user opens the scanner for the first time. See [Onboarding]
* for more details.
*
* @since 6.0.0
*/
onboarding?: Onboarding | null;
/**
* An optional toolbar item that shows scan tips when clicked. See [ScanTips] for more details.
*
* @since 6.0.0
*/
scanTips?: ScanTips | null;
/**
* Use this to enable/disable additional values to be detected. See [PaymentAnalyzeConfiguration] for
* more details.
*
* @since 6.0.0
*/
analyzeConfig?: PaymentAnalyzeConfiguration;
/**
* A screen that will be displayed if no payment information could be extracted.
* If you do not want to display the screen at all, just set it to null.
*
* @since 6.0.0
*/
emptyResultScreen?: EmptyResultScreen | null;
}
/**
* The result of {@link startPhotoPayment}.
*
* @since 6.0.0
*/
export interface StartPhotoPaymentResult {
/**
* The json result data for the document
*
* @since 6.0.0
*/
data?: string;
}
/**
* A configuration class used to alter the default document analysis behaviour.
*
* @deprecated Use `AnalyzeConfigurationOptions`.
* @since 1.0.0
*/
export interface AnalyzeConfiguration {
/**
* Read BIC.
*
* @since 1.0.0
*/
readBIC?: boolean;
/**
* Read payment state.
*
* @since 1.0.0
*/
readPaymentState?: boolean;
}
/**
* A configuration class used to alter the default document scan behaviour.
*
* @since 1.0.0
* @deprecated Use `StartDocumentScannerOptions`.
*/
export type DocumentScannerConfiguration = StartDocumentScannerOptions;