GmsDocumentScannerOptions.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
Sets whether to show a UI button to allow the user to import images from photo
gallery.
The default value is true
.
Sets a page limit for the maximum number of pages that can be scanned in a single
scanning session.
The provided value should be be greater than or equal to 1.
If no page limit is set, the restriction on the number of pages that can be scanned
is determined by hardware resources, e.g. memory, disk storage.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eGmsDocumentScannerOptions.Builder\u003c/code\u003e provides options for customizing the document scanning process, such as enabling gallery imports, setting page limits, defining result formats, and choosing the scanner mode.\u003c/p\u003e\n"],["\u003cp\u003eIt allows developers to control features like enabling/disabling gallery imports using \u003ccode\u003esetGalleryImportAllowed\u003c/code\u003e, limiting the number of scanned pages with \u003ccode\u003esetPageLimit\u003c/code\u003e, and setting desired output formats (JPEG, PDF) through \u003ccode\u003esetResultFormats\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can specify the scanner mode (\u003ccode\u003eSCANNER_MODE_FULL\u003c/code\u003e, \u003ccode\u003eSCANNER_MODE_BASE_WITH_FILTER\u003c/code\u003e, \u003ccode\u003eSCANNER_MODE_BASE\u003c/code\u003e) using \u003ccode\u003esetScannerMode\u003c/code\u003e to control the level of functionality and features available during scanning.\u003c/p\u003e\n"],["\u003cp\u003eAfter configuration, the \u003ccode\u003ebuild()\u003c/code\u003e method creates a \u003ccode\u003eGmsDocumentScannerOptions\u003c/code\u003e instance based on the specified settings, which is then used to initiate the document scanning process.\u003c/p\u003e\n"]]],["The `GmsDocumentScannerOptions.Builder` class constructs `GmsDocumentScannerOptions` instances. Key actions include: `build()` to finalize options, `setGalleryImportAllowed()` to enable gallery imports, `setPageLimit()` to restrict page numbers, `setResultFormats()` to specify output formats (JPEG, PDF), and `setScannerMode()` to define the scanner's enabled features (full, base with filter, base). Default settings are gallery import enabled, JPEG output, and full scanner mode.\n"],null,["# GmsDocumentScannerOptions.Builder\n\npublic static class **GmsDocumentScannerOptions.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder for [GmsDocumentScannerOptions](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions). \n\n### Public Constructor Summary\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder#Builder())() Builder for [GmsDocumentScannerOptions](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions). |\n\n### Public Method Summary\n\n|-----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [GmsDocumentScannerOptions](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions) | [build](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder#build())() Builds a [GmsDocumentScannerOptions](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions) instance. |\n| [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) | [setGalleryImportAllowed](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder#setGalleryImportAllowed(boolean))(boolean galleryImportAllowed) Sets whether to show a UI button to allow the user to import images from photo gallery. |\n| [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) | [setPageLimit](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder#setPageLimit(int))(int pageLimit) Sets a page limit for the maximum number of pages that can be scanned in a single scanning session. |\n| [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) | [setResultFormats](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder#setResultFormats(int,%20int...))(int format, int... moreFormats) Sets scanner [GmsDocumentScannerOptions.ResultFormat](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.ResultFormat)s. |\n| [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) | [setScannerMode](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder#setScannerMode(int))(int scannerMode) Sets the scanner mode which determines what features are enabled. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** ()\n\nBuilder for [GmsDocumentScannerOptions](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions).\n\nPublic Methods\n--------------\n\n#### public [GmsDocumentScannerOptions](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions) **build**\n()\n\nBuilds a [GmsDocumentScannerOptions](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions) instance. \n\n#### public [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) **setGalleryImportAllowed** (boolean galleryImportAllowed)\n\nSets whether to show a UI button to allow the user to import images from photo\ngallery.\n\nThe default value is `true`. \n\n#### public [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) **setPageLimit** (int pageLimit)\n\nSets a page limit for the maximum number of pages that can be scanned in a single\nscanning session.\n\nThe provided value should be be greater than or equal to 1.\n\nIf no page limit is set, the restriction on the number of pages that can be scanned\nis determined by hardware resources, e.g. memory, disk storage. \n\n#### public [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) **setResultFormats** (int format, int... moreFormats)\n\nSets scanner [GmsDocumentScannerOptions.ResultFormat](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.ResultFormat)s.\n\nAvailable formats: [GmsDocumentScannerOptions.RESULT_FORMAT_JPEG](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions#RESULT_FORMAT_JPEG), [GmsDocumentScannerOptions.RESULT_FORMAT_PDF](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions#RESULT_FORMAT_PDF).\n\nThe default value is [GmsDocumentScannerOptions.RESULT_FORMAT_JPEG](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions#RESULT_FORMAT_JPEG). \n\n#### public [GmsDocumentScannerOptions.Builder](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions.Builder) **setScannerMode** (int scannerMode)\n\nSets the scanner mode which determines what features are enabled.\n\nAvailable modes: [GmsDocumentScannerOptions.SCANNER_MODE_FULL](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions#SCANNER_MODE_FULL), [GmsDocumentScannerOptions.SCANNER_MODE_BASE_WITH_FILTER](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions#SCANNER_MODE_BASE_WITH_FILTER), [GmsDocumentScannerOptions.SCANNER_MODE_BASE](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions#SCANNER_MODE_BASE).\n\nThe default value is [GmsDocumentScannerOptions.SCANNER_MODE_FULL](/android/reference/com/google/mlkit/vision/documentscanner/GmsDocumentScannerOptions#SCANNER_MODE_FULL)."]]