ScanFlowConfiguration
Options for capturing, reviewing, and exporting scans with ScanFlow. Pass a configuration to ScanActivity.Contract or ScanFlow.scanWithConfiguration.
Use defaultFilter to choose the initial enhancement for each page and availableFilters to choose the filters offered to the user. See Filter for all filters and when to use them. For example, start with color enhancement and offer a smaller selection of filters:
import com.geniusscansdk.scanflow.ScanFlowConfiguration
import com.geniusscansdk.scanflow.ScanFlowConfiguration.Filter
val configuration = ScanFlowConfiguration(
defaultFilter = Filter.AUTOMATIC_COLOR,
availableFilters = listOf(
Filter.AUTOMATIC_COLOR,
Filter.AUTOMATIC_BLACK_AND_WHITE,
Filter.NONE
)
)To keep the same filter for every page, set defaultFilter and omit Action.EDIT_FILTER from postProcessingActions. This example still lets the user rotate scans and toggle distortion correction:
import com.geniusscansdk.scanflow.ScanFlowConfiguration
import com.geniusscansdk.scanflow.ScanFlowConfiguration.Action
import com.geniusscansdk.scanflow.ScanFlowConfiguration.Filter
import java.util.EnumSet
val configuration = ScanFlowConfiguration(
defaultFilter = Filter.AUTOMATIC_MONOCHROME,
postProcessingActions = EnumSet.of(Action.ROTATE, Action.CORRECT_DISTORTION)
)Constructors
Types
Editing buttons available on the post-processing and page review screens. Used by postProcessingActions.
Options for whether the crop validation screen should be shown after a scan has been captured by the user.
Whether to correct distortion caused by curved or folded paper. Used by defaultCurvatureCorrection.
Enhancement filters for defaultFilter and availableFilters.
Flash behavior when capturing a page with the camera. Used by defaultFlashMode.
Format of the document containing the captured pages. Used by multiPageFormat.
Languages and output formats for text recognition. Assign this to ocrConfiguration to enable OCR output. Provide at least one supported language in languages.
The various formats into which the OCR result can be made available.
How to rotate a scan after capture. Used by defaultScanOrientation.
Physical size of pages in the generated PDF file. Used by pdfPageSize.
The source of the scan flow.
The types of structured data to extract.
Properties
The filters shown in the filter selector, in display order. See Filter for all possible values. Defaults to Filter.NONE, Filter.AUTOMATIC, Filter.AUTOMATIC_MONOCHROME, Filter.AUTOMATIC_BLACK_AND_WHITE, Filter.AUTOMATIC_COLOR, and Filter.PHOTO.
UI background color. Default is black.
Whether to correct curved or folded documents by default. Defaults to CurvatureCorrectionMode.DISABLED. If postProcessingActions includes Action.CORRECT_DISTORTION, the user can override this setting for each page.
The initial enhancement filter for each page. Defaults to Filter.AUTOMATIC. See Filter for the available filters and their recommended uses.
The default flash mode used when capturing a page. Combine with ScanFlowConfiguration.flashButtonHidden if you want to only allow a specific flash mode. Default is FlashMode.OFF.
How to rotate scans after capture. Defaults to Orientation.AUTOMATIC. Use Orientation.ORIGINAL to keep the original orientation.
Whether to hide the flash button on the camera screen. Defaults to false.
UI foreground color (text and icons). Default is white.
Color of the document detection overlay. Default is blue.
JPEG quality used to compress captured images. Between 0 and 100, 100 being the best quality. Default is 60.
Whether the user can capture several pages in one camera session. Defaults to true. When false, the camera captures a single page. Only applies when source is Source.CAMERA.
Format of the document created with all the captured pages. When set to MultiPageFormat.NONE, no document will be generated but the individual pages will still be accessible in the ScanFlowResult. Defaults to MultiPageFormat.PDF.
The configuration for text recognition on each captured image. Defaults to null, which disables OCR output. To enable it, provide an OcrConfiguration with the languages to recognize. Structured-data extraction can still recognize text when needed, such as for StructuredData.RECEIPT.
Absolute directory where ScanFlow writes its output files.
Custom font file used during the PDF generation to embed an invisible text layer. If null, a default font is used, which only supports Latin languages.
Max scan dimension in pixels when generating the PDF file. All scans included in the PDF file will be scaled so that both their height and width are smaller than this value, while keeping their aspect ratio. Default is 0, which means no scaling is applied.
The size of the pages when multiPageFormat is MultiPageFormat.PDF. Defaults to PdfPageSize.FIT.
Optional password used to protect generated PDF documents. Defaults to null. An empty password is treated as no password. This only applies when multiPageFormat is MultiPageFormat.PDF.
Whether to hide the photo library button on the camera screen. Defaults to false.
The editing actions available on the post-processing and page review screens. Defaults to Action.ALL. These actions control the editing buttons, not the processing defaults. For example, omitting Action.EDIT_FILTER prevents the user from changing defaultFilter.
The readability level required for the scans. A warning will be displayed to the user if the readability of a scan is lower than this level. Defaults to ScanProcessor.ReadabilityLevel.Lowest, which does not require a minimum level of readability.
Controls whether the crop validation screen is automatically displayed after capture. Default is CropValidation.Never.
Whether to show a final review of all captured pages before submitting them for export. The user can review and edit the pages on this screen. Defaults to false.
Whether to skip showing the post-processing screen. We only recommend enabling this option when scanning structured data. Generally, you want the user to visually confirm the quality of each scan. Defaults to false. Image processing still runs when this screen is skipped. showCropValidation and showFinalReview control their screens independently.
The source for the scanned documents. Defaults to Source.CAMERA. If the source is Source.IMAGE, sourceImage must be provided. Use Source.GALLERY to let the user select an image from the photo library.
The image file to scan when source is Source.IMAGE. Defaults to null.
Types of structured data to extract from the document. Defaults to an empty set, which disables extraction. Multiple StructuredData values can be combined in an EnumSet.
If structuredData contains StructuredData.BARCODE, the list of barcode types to look for. Default is all supported types.