Class PdfConfiguration.Builder
-
- All Implemented Interfaces:
public final class PdfConfiguration.Builder
Builder used to construct PdfConfiguration instance.
-
-
Field Summary
Fields Modifier and Type Field Description private List<SignatureCreationMode>
signatureCreationModes
-
Constructor Summary
Constructors Constructor Description PdfConfiguration.Builder(PdfConfiguration configuration)
Create a new builder from existing configuration. PdfConfiguration.Builder()
-
Method Summary
Modifier and Type Method Description final List<SignatureCreationMode>
getSignatureCreationModes()
The ways in which the user can choose to add their signature. final Unit
setSignatureCreationModes(@Size(min = 1, max = 3) List<SignatureCreationMode> signatureCreationModes)
The ways in which the user can choose to add their signature. final PdfConfiguration.Builder
setFixedLowResRenderPixelCount(Integer fixedLowResRenderPixelCount)
Sets the number of pixels in low resolution renderings to a fixed size. final PdfConfiguration.Builder
setMultithreadedRenderingEnabled(Boolean isMultithreadedRenderingEnabled)
Sets whether the multithreaded rendering should be enabled. final PdfConfiguration.Builder
scrollDirection(PageScrollDirection orientation)
Sets scrolling direction for the document. final PdfConfiguration.Builder
scrollMode(PageScrollMode mode)
Sets the page scrolling mode - if the scrolling position will always snap to page or not. final PdfConfiguration.Builder
fitMode(PageFitMode mode)
Sets the page fit mode, or how the screen should fit the document. final PdfConfiguration.Builder
layoutMode(PageLayoutMode mode)
Sets the page layout mode, or how the document will layout the pages (as single pages, double pages or automatically). final PdfConfiguration.Builder
enableStylusOnDetection(Boolean enableStylusOnDetection)
Indicates whether we should automatically detect the stylus. final PdfConfiguration.Builder
themeMode(ThemeMode mode)
Sets the app theme mode. final PdfConfiguration.Builder
firstPageAlwaysSingle(Boolean firstPageAlwaysSingle)
Sets whether the first page should always be displayed as a single or not. final PdfConfiguration.Builder
showGapBetweenPages(Boolean showGapBetweenPages)
Sets whether to show gao between pages in double page mode or not. final PdfConfiguration.Builder
scrollbarsEnabled(Boolean scrollbarsEnabled)
Sets the document scrollbars to be enabled or disabled. final PdfConfiguration.Builder
backgroundColor(@ColorInt() Integer backgroundColor)
Sets color of PDF background. final PdfConfiguration.Builder
loadingProgressDrawable(@DrawableRes() Integer loadingProgressDrawable)
Sets a drawable for loading progress throbber while document is loaded. final PdfConfiguration.Builder
memoryCacheSize(Integer memoryCacheSize)
Sets the size of memory cache for rendered pages and bitmaps. final PdfConfiguration.Builder
invertColors(Boolean invertColors)
Sets if the colors will be inverted in the document. final PdfConfiguration.Builder
toGrayscale(Boolean toGrayscale)
Sets if the colors will be converted to grayscale. final PdfConfiguration.Builder
startZoomScale(Float startZoomScale)
Sets the start scale at which the document will be displayed. final PdfConfiguration.Builder
maxZoomScale(@FloatRange(from = 1.0, to = 20.0) Float scale)
Sets the maximum zoom scale at which the document should be displayed. final PdfConfiguration.Builder
zoomOutBounce(Boolean zoomOutBounce)
Should the zoom out below the minimum zoom have a bounce-back effect on a page. final PdfConfiguration.Builder
excludedAnnotationTypes(List<AnnotationType> excludedAnnotationTypes)
Sets a list of annotation types that will be excluded from rendering. final PdfConfiguration.Builder
autosaveEnabled(Boolean isAutosaveEnabled)
Enables or disables auto-saving of PDF document changes. final PdfConfiguration.Builder
textSelectionEnabled(Boolean isTextSelectionEnabled)
Enables or disables text selection (both programmatically and via long-press gesture). final PdfConfiguration.Builder
formEditingEnabled(Boolean enabled)
Enable/disable form editing functionality. final PdfConfiguration.Builder
enableFormEditing()
Enables form editing functionality. final PdfConfiguration.Builder
disableFormEditing()
Disables form editing functionality. final PdfConfiguration.Builder
autoSelectNextFormElementEnabled(Boolean enabled)
Enable/disable functionality that automatically selects next form element. final PdfConfiguration.Builder
enableAutoSelectNextFormElement()
Enables functionality that automatically selects next form element. final PdfConfiguration.Builder
disableAutoSelectNextFormElement()
Disables functionality that automatically selects next form element. final PdfConfiguration.Builder
formElementDateAndTimePickerEnabled(Boolean enabled)
Enables/Disables date and time picker for form elements. final PdfConfiguration.Builder
annotationEditingEnabled(Boolean enable)
Enable/disable annotation editing functionality. final PdfConfiguration.Builder
enableAnnotationEditing()
Enables annotation editing functionality. final PdfConfiguration.Builder
disableAnnotationEditing()
Disables annotation editing functionality. final PdfConfiguration.Builder
annotationRotationEnabled(Boolean enable)
Enable/disable annotation rotation functionality. final PdfConfiguration.Builder
enableAnnotationRotation()
Enables annotation rotation functionality. final PdfConfiguration.Builder
disableAnnotationRotation()
Disables annotation rotation functionality. final PdfConfiguration.Builder
contentEditingEnabled(Boolean enable)
Enable/disable content editing functionality. final PdfConfiguration.Builder
enableContentEditing()
Enables content editing functionality. final PdfConfiguration.Builder
disableContentEditing()
Disables content editing functionality. final PdfConfiguration.Builder
setMeasurementToolsEnabled(Boolean measurementToolsEnabled)
Enables or disables measurement tools functionality. final PdfConfiguration.Builder
disableAnnotationLimitedToPageBounds()
Disables the page bounds limit imposed when dragging annotations. final PdfConfiguration.Builder
rectangleSelectionForMarkupAnnotationsEnabled(Boolean enabled)
Enable/disable the rectangle selection for text markup annotations and disables character based text selection for markup annotations and text redaction. final PdfConfiguration.Builder
enableRectangleSelectionForMarkupAnnotations()
Enables the rectangle selection for text markup annotations and disables character based text selection for markup annotations and text redaction. final PdfConfiguration.Builder
disableRectangleSelectionForMarkupAnnotations()
Disables the rectangle selection for text markup and redaction annotations and enables character based text selection. final PdfConfiguration.Builder
editableAnnotationTypes(List<AnnotationType> editableAnnotationTypes)
Sets a list of annotation types that can be selected on page and edited. final PdfConfiguration.Builder
enabledAnnotationTools(List<AnnotationTool> enabledAnnotationTools)
Sets a list of annotation tools that are enabled. final PdfConfiguration.Builder
setSelectedAnnotationResizeEnabled(Boolean enabled)
Enable or disable resizing of selected annotations. final PdfConfiguration.Builder
setSelectedAnnotationResizeGuidesEnabled(Boolean enabled)
Enables or disables resize guides. final PdfConfiguration.Builder
setSelectedAnnotationFontScalingOnResizeEnabled(Boolean enabled)
Enables or disables font scaling for Freetext annotations when resizing with the bottom right resize handle. final PdfConfiguration.Builder
setResizeGuideSnapAllowance(@FloatRange(from = 0.0) Float snapAllowance)
Sets how aggressively the resize guides works. final PdfConfiguration.Builder
setResizeGuideLineIntervals(@Size(min = 2, multiple = 2) List<Float> intervals)
Sets guide line on/off intervals sizes. final PdfConfiguration.Builder
setAnnotationInspectorEnabled(Boolean isEnabled)
Sets whether the annotation inspector is enabled. final PdfConfiguration.Builder
pagePadding(Integer pagePaddingDp)
Sets the padding between pages. final PdfConfiguration.Builder
videoPlaybackEnabled(Boolean videoPlaybackEnabled)
Enables or disables video playback. final PdfConfiguration.Builder
playingMultipleMediaInstancesEnabled(Boolean playingMultipleMediaInstancesEnabled)
Sets whether playing multiple media instances is enabled or not. final PdfConfiguration.Builder
restoreLastViewedPage(Boolean restoreLastViewedPage)
Enables or disables restoration of the last viewed page when reopening a document. final PdfConfiguration.Builder
automaticallyGenerateLinks(Boolean automaticallyGenerateLinks)
Enables or disables automatic link generation. final PdfConfiguration.Builder
copyPastEnabled(Boolean enable)
Enable/disable copy and paste of annotations. final PdfConfiguration.Builder
enableCopyPaste()
Enables copy and paste of annotations. final PdfConfiguration.Builder
disableCopyPaste()
Disables copy and paste of annotations. final PdfConfiguration.Builder
setEnabledCopyPasteFeatures(EnumSet<CopyPasteFeatures> enabledFeatures)
Sets the CopyPasteFeatures that are enabled. final PdfConfiguration.Builder
undoEnabled(Boolean undoEnabled)
Enables or disables undo support. final PdfConfiguration.Builder
redoEnabled(Boolean redoEnabled)
Enables or disables redo support. final PdfConfiguration.Builder
annotationReplyFeatures(AnnotationReplyFeatures annotationReplyFeatures)
Configures which part of the annotation replies UI is enabled. final PdfConfiguration.Builder
setEnabledShareFeatures(EnumSet<ShareFeatures> enabledShareFeatures)
Configures which share features are enabled in the UI. final PdfConfiguration.Builder
setSignaturePickerOrientation(SignaturePickerOrientation orientation)
Sets the orientation to use for the signature picker. final PdfConfiguration.Builder
signatureSavingStrategy(SignatureSavingStrategy signatureSavingStrategy)
Defines if a signature should be saved after creation. final PdfConfiguration.Builder
signatureColorOptions(SignatureColorOptions signatureColorOptions)
Defines the 3 signature color options available when using the Electronic Signatures "Draw" or "Type" signing UI. final PdfConfiguration.Builder
signatureCreationModes(@Size(min = 1, max = 3) List<SignatureCreationMode> signatureCreationModes)
The ways in which the user can choose to add their signature. final PdfConfiguration.Builder
setEnableNoteAnnotationNoZoomHandling(Boolean noZoomHandlingEnabled)
Enables or disables handling for AnnotationFlags.NOZOOM flag for note annotations. final PdfConfiguration.Builder
setJavaScriptEnabled(Boolean isEnabled)
Enables or disables JavaScript processing. final PdfConfiguration.Builder
textSelectionPopupToolbarEnabled(Boolean enabled)
Sets whether the text selection popup toolbar is enabled or not. final PdfConfiguration.Builder
annotationPopupToolbarEnabled(Boolean enabled)
Sets whether the annotation popup toolbar is enabled or not. final PdfConfiguration.Builder
allowMultipleBookmarksPerPage(Boolean allowed)
Sets whether multiple bookmarks per page can be added or not. final PdfConfiguration.Builder
scrollOnEdgeTapEnabled(Boolean enabled)
Sets whether taps on the edge of a page scroll to the next / previous page. final PdfConfiguration.Builder
animateScrollOnEdgeTaps(Boolean enabled)
Sets whether page changes triggered by tapping the page edge cause an animation. final PdfConfiguration.Builder
scrollOnEdgeTapMargin(@IntRange(from = 1) Integer marginDp)
Margin in dp in which taps on the edge of the page will trigger the page navigation. final PdfConfiguration.Builder
magnifierEnabled(Boolean enabled)
Sets whether the magnifier is shown when text selection handles are touched. final PdfConfiguration.Builder
showSignHereOverlay(Boolean showOverlay)
Sets whether the sign here overlay is shown inside of signature form fields. final PdfConfiguration.Builder
showNoteEditorForNewNoteAnnotations(Boolean showNoteEditorForNewNoteAnnotations)
Sets whether the note editor should be started automatically for newly created note annotations. final PdfConfiguration.Builder
setOutlineElementState(OutlineElementState outlineElementState)
Sets whether outline elements are expanded or collapsed. final PdfConfiguration
build()
Creates a @{link PdfConfiguration} with the arguments supplied to this builder. -
-
Constructor Detail
-
PdfConfiguration.Builder
PdfConfiguration.Builder(PdfConfiguration configuration)
Create a new builder from existing configuration.- Parameters:
configuration
- PdfConfiguration used to initialized builder.
-
PdfConfiguration.Builder
PdfConfiguration.Builder()
-
-
Method Detail
-
getSignatureCreationModes
final List<SignatureCreationMode> getSignatureCreationModes()
The ways in which the user can choose to add their signature.
These are shown in the order specified as tabs across the top of the signatures UI. The first entry will be selected initially. If this array contains a single entry then the tabs will be hidden. This array must not be empty and must not contain duplicates.
-
setSignatureCreationModes
final Unit setSignatureCreationModes(@Size(min = 1, max = 3) List<SignatureCreationMode> signatureCreationModes)
The ways in which the user can choose to add their signature.
These are shown in the order specified as tabs across the top of the signatures UI. The first entry will be selected initially. If this array contains a single entry then the tabs will be hidden. This array must not be empty and must not contain duplicates.
-
setFixedLowResRenderPixelCount
final PdfConfiguration.Builder setFixedLowResRenderPixelCount(Integer fixedLowResRenderPixelCount)
Sets the number of pixels in low resolution renderings to a fixed size. By default, the size (i.e. the resolution) of low-res page renderings inside the PdfFragment will be set to an optimized pixel count, based on the device specs and performance. Using this method, you can override the default and set it to a fixed value.
- Parameters:
fixedLowResRenderPixelCount
- Fixed low resolution pixel count, may benull
.
-
setMultithreadedRenderingEnabled
final PdfConfiguration.Builder setMultithreadedRenderingEnabled(Boolean isMultithreadedRenderingEnabled)
Sets whether the multithreaded rendering should be enabled. Defaults to
true
.Multithreaded rendering speeds up page rendering. Disabling it may speed things up if, for example, you know you only have to render single page of the document.
- Parameters:
isMultithreadedRenderingEnabled
-true
to enable multithreaded rendering,false
to disable.
-
scrollDirection
final PdfConfiguration.Builder scrollDirection(PageScrollDirection orientation)
Sets scrolling direction for the document.
- Parameters:
orientation
- Scrolling direction set with PageScrollDirection.
-
scrollMode
final PdfConfiguration.Builder scrollMode(PageScrollMode mode)
Sets the page scrolling mode - if the scrolling position will always snap to page or not.
- Parameters:
mode
- Scrolling mode set with PageScrollMode.
-
fitMode
final PdfConfiguration.Builder fitMode(PageFitMode mode)
Sets the page fit mode, or how the screen should fit the document. Default is fit-to-page.
- Parameters:
mode
- Fit mode set with PageFitMode.
-
layoutMode
final PdfConfiguration.Builder layoutMode(PageLayoutMode mode)
Sets the page layout mode, or how the document will layout the pages (as single pages, double pages or automatically).
- Parameters:
mode
- Layout mode set with PageLayoutMode.
-
enableStylusOnDetection
final PdfConfiguration.Builder enableStylusOnDetection(Boolean enableStylusOnDetection)
Indicates whether we should automatically detect the stylus. Enabling this will automatically disable all other inputs once we detect stylus use. Enabling this will also allow for swiping between pages with the finger during annotating and automatically turn on the "Use stylus for annotating" switch, if it is off. Disabling this setting allows for drawing with both the stylus and the finger but prevents swiping with the finger during annotating unless the "Use stylus for annotating" setting switch in the document has been manually turned on. Defaults to
true
-
themeMode
final PdfConfiguration.Builder themeMode(ThemeMode mode)
Sets the app theme mode. Night mode automatically inverts colors.
- Parameters:
mode
- Theme mode set with ThemeMode.
-
firstPageAlwaysSingle
final PdfConfiguration.Builder firstPageAlwaysSingle(Boolean firstPageAlwaysSingle)
Sets whether the first page should always be displayed as a single or not. This is notable only if double page mode is active.
- Parameters:
firstPageAlwaysSingle
-true
to always display the first page as a single one,false
otherwise.
-
showGapBetweenPages
final PdfConfiguration.Builder showGapBetweenPages(Boolean showGapBetweenPages)
Sets whether to show gao between pages in double page mode or not.
- Parameters:
showGapBetweenPages
- Iftrue
, there will be a gap between pages in double page mode, iffalse
the pages will be joined.
-
scrollbarsEnabled
final PdfConfiguration.Builder scrollbarsEnabled(Boolean scrollbarsEnabled)
Sets the document scrollbars to be enabled or disabled.
- Parameters:
scrollbarsEnabled
-true
to enable document scrollbars (default), orfalse
to disable them.
-
backgroundColor
final PdfConfiguration.Builder backgroundColor(@ColorInt() Integer backgroundColor)
Sets color of PDF background. White by default.
- Parameters:
backgroundColor
- Paper color in integer format.
-
loadingProgressDrawable
final PdfConfiguration.Builder loadingProgressDrawable(@DrawableRes() Integer loadingProgressDrawable)
Sets a drawable for loading progress throbber while document is loaded.
- Parameters:
loadingProgressDrawable
- Resource ID of the progress drawable.
-
memoryCacheSize
final PdfConfiguration.Builder memoryCacheSize(Integer memoryCacheSize)
Sets the size of memory cache for rendered pages and bitmaps. It defaults to 1/4 of available heap size of the app. Note that disabling this might lead to severe performance problems.
- Parameters:
memoryCacheSize
- Size of memory cache in bytes.
-
invertColors
final PdfConfiguration.Builder invertColors(Boolean invertColors)
Sets if the colors will be inverted in the document. This is disabled by default.
- Parameters:
invertColors
-true
if colors should be inverted,false
otherwise
-
toGrayscale
final PdfConfiguration.Builder toGrayscale(Boolean toGrayscale)
Sets if the colors will be converted to grayscale. This is disabled by default.
- Parameters:
toGrayscale
-true
if page should be rendered in grayscale,false
otherwise
-
startZoomScale
final PdfConfiguration.Builder startZoomScale(Float startZoomScale)
Sets the start scale at which the document will be displayed.
Default value: {@value PdfFragment#DEFAULT_ZOOM}
- Parameters:
startZoomScale
- Starting zoom scale factor.
-
maxZoomScale
final PdfConfiguration.Builder maxZoomScale(@FloatRange(from = 1.0, to = 20.0) Float scale)
Sets the maximum zoom scale at which the document should be displayed. Make sure this value is higher than defaultZoomScale.
Default value: {@value PdfFragment#MAX_ZOOM}.
Allowed interval: 1.0, 20.0
- Parameters:
scale
- Maximum zoom scale factor.
-
zoomOutBounce
final PdfConfiguration.Builder zoomOutBounce(Boolean zoomOutBounce)
Should the zoom out below the minimum zoom have a bounce-back effect on a page.
- Parameters:
zoomOutBounce
-true
if document should have a zoom-out bounce effect,false
otherwise.
-
excludedAnnotationTypes
final PdfConfiguration.Builder excludedAnnotationTypes(List<AnnotationType> excludedAnnotationTypes)
Sets a list of annotation types that will be excluded from rendering.
- Parameters:
excludedAnnotationTypes
- List of annotation types that will be excluded from rendering.
-
autosaveEnabled
final PdfConfiguration.Builder autosaveEnabled(Boolean isAutosaveEnabled)
Enables or disables auto-saving of PDF document changes. This is enabled by default.
- Parameters:
isAutosaveEnabled
-true
to enable autosave in onStop() of the document fragment,false
otherwise.
-
textSelectionEnabled
final PdfConfiguration.Builder textSelectionEnabled(Boolean isTextSelectionEnabled)
Enables or disables text selection (both programmatically and via long-press gesture). This is enabled by default.
- Parameters:
isTextSelectionEnabled
-true
to enable text selection, orfalse
to disable it.
-
formEditingEnabled
final PdfConfiguration.Builder formEditingEnabled(Boolean enabled)
Enable/disable form editing functionality.
-
enableFormEditing
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "formEditingEnabled(true) ")) final PdfConfiguration.Builder enableFormEditing()
Enables form editing functionality.
-
disableFormEditing
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "formEditingEnabled(false) ")) final PdfConfiguration.Builder disableFormEditing()
Disables form editing functionality.
-
autoSelectNextFormElementEnabled
final PdfConfiguration.Builder autoSelectNextFormElementEnabled(Boolean enabled)
Enable/disable functionality that automatically selects next form element. Disabled by default.
-
enableAutoSelectNextFormElement
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "autoSelectNextFormElementEnabled(true) ")) final PdfConfiguration.Builder enableAutoSelectNextFormElement()
Enables functionality that automatically selects next form element. Disabled by default.
-
disableAutoSelectNextFormElement
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "autoSelectNextFormElementEnabled(false) ")) final PdfConfiguration.Builder disableAutoSelectNextFormElement()
Disables functionality that automatically selects next form element. Disabled by default.
-
formElementDateAndTimePickerEnabled
final PdfConfiguration.Builder formElementDateAndTimePickerEnabled(Boolean enabled)
Enables/Disables date and time picker for form elements. Enabled by default.
-
annotationEditingEnabled
final PdfConfiguration.Builder annotationEditingEnabled(Boolean enable)
Enable/disable annotation editing functionality.
-
enableAnnotationEditing
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "annotationEditingEnabled(true) ")) final PdfConfiguration.Builder enableAnnotationEditing()
Enables annotation editing functionality.
-
disableAnnotationEditing
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "annotationEditingEnabled(false) ")) final PdfConfiguration.Builder disableAnnotationEditing()
Disables annotation editing functionality.
-
annotationRotationEnabled
final PdfConfiguration.Builder annotationRotationEnabled(Boolean enable)
Enable/disable annotation rotation functionality.
-
enableAnnotationRotation
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "annotationRotationEnabled(true) ")) final PdfConfiguration.Builder enableAnnotationRotation()
Enables annotation rotation functionality.
-
disableAnnotationRotation
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "annotationRotationEnabled(false) ")) final PdfConfiguration.Builder disableAnnotationRotation()
Disables annotation rotation functionality.
-
contentEditingEnabled
final PdfConfiguration.Builder contentEditingEnabled(Boolean enable)
Enable/disable content editing functionality.
-
enableContentEditing
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "contentEditingEnabled(true) ")) final PdfConfiguration.Builder enableContentEditing()
Enables content editing functionality.
-
disableContentEditing
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "contentEditingEnabled(false) ")) final PdfConfiguration.Builder disableContentEditing()
Disables content editing functionality.
-
setMeasurementToolsEnabled
final PdfConfiguration.Builder setMeasurementToolsEnabled(Boolean measurementToolsEnabled)
Enables or disables measurement tools functionality.
- Parameters:
measurementToolsEnabled
-true
to enable measurement tools (if licensed), orfalse
to disable it.
-
disableAnnotationLimitedToPageBounds
final PdfConfiguration.Builder disableAnnotationLimitedToPageBounds()
Disables the page bounds limit imposed when dragging annotations. By default this is enabled. Note: this is an experimental feature - we cannot guarantee flawless behaviour or that it won't change in future.
-
rectangleSelectionForMarkupAnnotationsEnabled
final PdfConfiguration.Builder rectangleSelectionForMarkupAnnotationsEnabled(Boolean enabled)
Enable/disable the rectangle selection for text markup annotations and disables character based text selection for markup annotations and text redaction. By default rectangle selection is disabled and character based text selection is used.
-
enableRectangleSelectionForMarkupAnnotations
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "rectangleSelectionForMarkupAnnotationsEnabled(true) ")) final PdfConfiguration.Builder enableRectangleSelectionForMarkupAnnotations()
Enables the rectangle selection for text markup annotations and disables character based text selection for markup annotations and text redaction. By default rectangle selection is disabled and character based text selection is used.
-
disableRectangleSelectionForMarkupAnnotations
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "rectangleSelectionForMarkupAnnotationsEnabled(false) ")) final PdfConfiguration.Builder disableRectangleSelectionForMarkupAnnotations()
Disables the rectangle selection for text markup and redaction annotations and enables character based text selection. By default rectangle selection is disabled and character based text selection is used.
-
editableAnnotationTypes
final PdfConfiguration.Builder editableAnnotationTypes(List<AnnotationType> editableAnnotationTypes)
Sets a list of annotation types that can be selected on page and edited.
- Parameters:
editableAnnotationTypes
- List of annotation types that are selectable.
-
enabledAnnotationTools
final PdfConfiguration.Builder enabledAnnotationTools(List<AnnotationTool> enabledAnnotationTools)
Sets a list of annotation tools that are enabled.
Note: AnnotationTool will be enabled only when its underlying annotation type (AnnotationTool.toAnnotationType) is editable (see editableAnnotationTypes) and annotation editing is enabled (see enableAnnotationEditing).
- Parameters:
enabledAnnotationTools
- List of supported annotation tools.
-
setSelectedAnnotationResizeEnabled
final PdfConfiguration.Builder setSelectedAnnotationResizeEnabled(Boolean enabled)
Enable or disable resizing of selected annotations. This defaults to
true
.- Parameters:
enabled
-true
to enable resizing of selected annotations, orfalse
to disable resizing.
-
setSelectedAnnotationResizeGuidesEnabled
final PdfConfiguration.Builder setSelectedAnnotationResizeGuidesEnabled(Boolean enabled)
Enables or disables resize guides. This defaults to
true
.- Parameters:
enabled
-true
to enable resize guides for resizable annotations, orfalse
to disable guides.
-
setSelectedAnnotationFontScalingOnResizeEnabled
final PdfConfiguration.Builder setSelectedAnnotationFontScalingOnResizeEnabled(Boolean enabled)
Enables or disables font scaling for Freetext annotations when resizing with the bottom right resize handle. This defaults to
true
.- Parameters:
enabled
-true
to enable font scaling, orfalse
to disable it.
-
setResizeGuideSnapAllowance
final PdfConfiguration.Builder setResizeGuideSnapAllowance(@FloatRange(from = 0.0) Float snapAllowance)
Sets how aggressively the resize guides works. Defaults to
30.0f
.- Parameters:
snapAllowance
- How many pixels around the guide line will snap to guide when resizing.
-
setResizeGuideLineIntervals
final PdfConfiguration.Builder setResizeGuideLineIntervals(@Size(min = 2, multiple = 2) List<Float> intervals)
Sets guide line on/off intervals sizes. Must have an even number of entries (>=2). Even indices are specifying the "on" intervals, the odd indices specifying the "off" intervals. "On" intervals specify length of the line dashes, "Off" specify length of the line gaps. Defaults to
[5f, 20f]
.- Parameters:
intervals
- List of ON and OFF distances.
-
setAnnotationInspectorEnabled
final PdfConfiguration.Builder setAnnotationInspectorEnabled(Boolean isEnabled)
Sets whether the annotation inspector is enabled. This defaults to
true
.- Parameters:
isEnabled
-true
to enable annotation inspector when creating and editing the annotations.
-
pagePadding
final PdfConfiguration.Builder pagePadding(Integer pagePaddingDp)
Sets the padding between pages. Defaults to 16dp.
- Parameters:
pagePaddingDp
- Padding between pages in density independent pixels (dp).
-
videoPlaybackEnabled
final PdfConfiguration.Builder videoPlaybackEnabled(Boolean videoPlaybackEnabled)
Enables or disables video playback. By default, video playback would be disabled unless the device is deemed secure, meaning the device is running at least Android Marshmallow (API 23+) with security patch dating Feb 1st, 2016 or newer.
Feb 1st, 2016 patch fixes a Critical security vulnerability that could enable remote code execution on an affected device through multiple methods such as email, web browsing, and MMS when processing media files.
- Parameters:
videoPlaybackEnabled
-true
if video playback is enabled,false
otherwise.
-
playingMultipleMediaInstancesEnabled
final PdfConfiguration.Builder playingMultipleMediaInstancesEnabled(Boolean playingMultipleMediaInstancesEnabled)
Sets whether playing multiple media instances is enabled or not. This is disabled by default.
- Parameters:
playingMultipleMediaInstancesEnabled
-true
to enabled playing multiple media instances,false
to only play one at a time.
-
restoreLastViewedPage
final PdfConfiguration.Builder restoreLastViewedPage(Boolean restoreLastViewedPage)
Enables or disables restoration of the last viewed page when reopening a document. If
true
, the last viewed page will be restored when opening the document a second time. Iffalse
, the document will be opened at page index0
. Defaults totrue
.- Parameters:
restoreLastViewedPage
-true
to enable restoration of the last viewed page, orfalse
to disable it.
-
automaticallyGenerateLinks
final PdfConfiguration.Builder automaticallyGenerateLinks(Boolean automaticallyGenerateLinks)
Enables or disables automatic link generation. If
true
we will automatically parse the text and generate clickable links for all URLs and eMail addresses in the document text.- Parameters:
automaticallyGenerateLinks
-true
to enable automatic link generation, orfalse
to disable it.
-
copyPastEnabled
final PdfConfiguration.Builder copyPastEnabled(Boolean enable)
Enable/disable copy and paste of annotations.
-
enableCopyPaste
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "copyPastEnabled(true) ")) final PdfConfiguration.Builder enableCopyPaste()
Enables copy and paste of annotations.
-
disableCopyPaste
@Deprecated(message = "v2024.8: Will be removed in 2025.", replaceWith = @ReplaceWith(imports = {}, expression = "copyPastEnabled(false) ")) final PdfConfiguration.Builder disableCopyPaste()
Disables copy and paste of annotations.
-
setEnabledCopyPasteFeatures
final PdfConfiguration.Builder setEnabledCopyPasteFeatures(EnumSet<CopyPasteFeatures> enabledFeatures)
Sets the CopyPasteFeatures that are enabled. Defaults to all features being enabled.
-
undoEnabled
final PdfConfiguration.Builder undoEnabled(Boolean undoEnabled)
Enables or disables undo support. If
true
we will keep track of edits to the document and allow the user to undo actions. Iffalse
the user will not be able to undo edits and redo will also be disabled.- Parameters:
undoEnabled
-true
to enable undo support, orfalse
to disable it.
-
redoEnabled
final PdfConfiguration.Builder redoEnabled(Boolean redoEnabled)
Enables or disables redo support. If
true
we will allow the user to redo changes that were undone before. Iffalse
the user will not be able to redo edits. If undo is disabled setting this totrue
will not do anything.- Parameters:
redoEnabled
-true
to enable redo support, orfalse
to disable it.
-
annotationReplyFeatures
final PdfConfiguration.Builder annotationReplyFeatures(AnnotationReplyFeatures annotationReplyFeatures)
Configures which part of the annotation replies UI is enabled. If , the replies can be added to note annotations and annotation notes. If AnnotationReplyFeatures.READ_ONLY, the replies can be looked at but none can be added or modified. If AnnotationReplyFeatures.DISABLED, the reply UI is disabled entirely. This feature is only UI specific, defining the replies availability in the PdfFragment's UI. The API for retrieving and adding replies still works even if this property is AnnotationReplyFeatures.DISABLED.
- Parameters:
annotationReplyFeatures
- Which features of annotation reply UI to enable.
-
setEnabledShareFeatures
final PdfConfiguration.Builder setEnabledShareFeatures(EnumSet<ShareFeatures> enabledShareFeatures)
Configures which share features are enabled in the UI. This feature is only UI specific, defining the available sharing features in the PdfFragment. The sharing API still works even if a specific share feature is disabled.
- Parameters:
enabledShareFeatures
- Set of share features to enable.
-
setSignaturePickerOrientation
final PdfConfiguration.Builder setSignaturePickerOrientation(SignaturePickerOrientation orientation)
- Parameters:
orientation
- The orientation to use for the signature picker.
-
signatureSavingStrategy
final PdfConfiguration.Builder signatureSavingStrategy(SignatureSavingStrategy signatureSavingStrategy)
Defines if a signature should be saved after creation. When the Electronic Signature component is available, saving defaults to SignatureSavingStrategy.NEVER_SAVE. If the license used is on Legacy Signatures, the property will default to SignatureSavingStrategy.SAVE_IF_SELECTED.
If not set to SignatureSavingStrategy.NEVER_SAVE then a storage database must be passed to PdfFragment.setSignatureStorage.
- Parameters:
signatureSavingStrategy
- Signature strategy to apply to saving signatures.
-
signatureColorOptions
final PdfConfiguration.Builder signatureColorOptions(SignatureColorOptions signatureColorOptions)
Defines the 3 signature color options available when using the Electronic Signatures "Draw" or "Type" signing UI. Defaults to black, purple, and blue.
- Parameters:
signatureColorOptions
- Can be created from @ColorRes or @ColorInt with SignatureColorOptions.fromColorRes and SignatureColorOptions.fromColorInt respectively.
-
signatureCreationModes
final PdfConfiguration.Builder signatureCreationModes(@Size(min = 1, max = 3) List<SignatureCreationMode> signatureCreationModes)
The ways in which the user can choose to add their signature.
These are shown in the order specified as tabs across the top of the signatures UI. The first entry will be selected initially. If this array contains a single entry then the tabs will be hidden. This array must not be empty and must not contain duplicates.
- Parameters:
signatureCreationModes
- An array of SignatureCreationMode values.
-
setEnableNoteAnnotationNoZoomHandling
final PdfConfiguration.Builder setEnableNoteAnnotationNoZoomHandling(Boolean noZoomHandlingEnabled)
Enables or disables handling for AnnotationFlags.NOZOOM flag for note annotations. Note annotations are always displayed as if AnnotationFlags.NOZOOM flag was set by default.
- Parameters:
noZoomHandlingEnabled
- Iftrue
, note annotations will respect missing AnnotationFlags.NOZOOM flag and will allow zoom in that case.
-
setJavaScriptEnabled
final PdfConfiguration.Builder setJavaScriptEnabled(Boolean isEnabled)
Enables or disables JavaScript processing. Defaults to
true
.Note: Processing JavaScript can be slow for documents with a large number of document providers or scripts. Disabling in most cases will not have any negative effects.
- Parameters:
isEnabled
-true
to enable JavaScript processing for loaded documents.
-
textSelectionPopupToolbarEnabled
final PdfConfiguration.Builder textSelectionPopupToolbarEnabled(Boolean enabled)
Sets whether the text selection popup toolbar is enabled or not. If disabled, and this configuration is used within your com.pspdfkit.ui.PdfActivity, the old text selection toolbar will be used.
- Parameters:
enabled
-true
to enable it,false
otherwise.
-
annotationPopupToolbarEnabled
final PdfConfiguration.Builder annotationPopupToolbarEnabled(Boolean enabled)
Sets whether the annotation popup toolbar is enabled or not. If disabled, we don't show the popup toolbar when you long press a selected annotation.
- Parameters:
enabled
-true
to enable it,false
to disable it.
-
allowMultipleBookmarksPerPage
final PdfConfiguration.Builder allowMultipleBookmarksPerPage(Boolean allowed)
Sets whether multiple bookmarks per page can be added or not. If disabled only one bookmark will be allowed per page. Defaults to
false
allowing only one bookmark per page.- Parameters:
allowed
-true
to allow adding multiple bookmarks to a page, orfalse
so that only one bookmark can be added per page.
-
scrollOnEdgeTapEnabled
final PdfConfiguration.Builder scrollOnEdgeTapEnabled(Boolean enabled)
Sets whether taps on the edge of a page scroll to the next / previous page. Defaults to
true
enabling scrolling by tapping the edge of pages.- Parameters:
enabled
-true
to enable scrolling by tapping the edge,false
to disable scrolling by tapping the edge.
-
animateScrollOnEdgeTaps
final PdfConfiguration.Builder animateScrollOnEdgeTaps(Boolean enabled)
Sets whether page changes triggered by tapping the page edge cause an animation. Defaults to
false
making the transition instant.- Parameters:
enabled
-true
to enable page change animation,false
to disable page change animation when tapping the page edge.
-
scrollOnEdgeTapMargin
final PdfConfiguration.Builder scrollOnEdgeTapMargin(@IntRange(from = 1) Integer marginDp)
Margin in dp in which taps on the edge of the page will trigger the page navigation. Defaults to
24dp
.- Parameters:
marginDp
- The margin in which taps on the edge of the page should trigger page navigation.
-
magnifierEnabled
final PdfConfiguration.Builder magnifierEnabled(Boolean enabled)
Sets whether the magnifier is shown when text selection handles are touched. Defaults to
true
.- Parameters:
enabled
-true
to enable the magnifier,false
otherwise.
-
showSignHereOverlay
final PdfConfiguration.Builder showSignHereOverlay(Boolean showOverlay)
Sets whether the sign here overlay is shown inside of signature form fields. Defaults to
true
.- Parameters:
showOverlay
-true
to show the sign here overlay in signature form fields,false
to hide it.
-
showNoteEditorForNewNoteAnnotations
final PdfConfiguration.Builder showNoteEditorForNewNoteAnnotations(Boolean showNoteEditorForNewNoteAnnotations)
Sets whether the note editor should be started automatically for newly created note annotations. Defaults to
true
.- Parameters:
showNoteEditorForNewNoteAnnotations
-true
if the note editor should be started automatically,
-
setOutlineElementState
final PdfConfiguration.Builder setOutlineElementState(OutlineElementState outlineElementState)
Sets whether outline elements are expanded or collapsed.
-
build
final PdfConfiguration build()
Creates a @{link PdfConfiguration} with the arguments supplied to this builder.
- Returns:
Newly created configuration.
-
-
-
-