Class PdfConfiguration.Builder

    • Constructor Detail

      • 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 be null.
      • 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.
      • 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

      • 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 - If true, there will be a gap between pages in double page mode, if false 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), or false to disable them.
      • 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.
      • 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, or false 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.

      • 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.
      • setWebViewFileAccessAllowed

         final PdfConfiguration.Builder setWebViewFileAccessAllowed(Boolean isWebViewFileAccessAllowed)

        Set whether file access should be allowed in webview via WebSettings.setAllowFileAccess(). Defaults to false

        Parameters:
        isWebViewFileAccessAllowed - true if file access should be enabled in webview
      • 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. If false, the document will be opened at page index 0. Defaults to true.

        Parameters:
        restoreLastViewedPage - true to enable restoration of the last viewed page, or false 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, or false to disable it.
      • 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. If false the user will not be able to undo edits and redo will also be disabled.

        Parameters:
        undoEnabled - true to enable undo support, or false 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. If false the user will not be able to redo edits. If undo is disabled setting this to true will not do anything.

        Parameters:
        redoEnabled - true to enable redo support, or false to disable it.
      • 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.
      • 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.
      • 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.
      • 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, or false 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,
      • build

         final PdfConfiguration build()

        Creates a @{link PdfConfiguration} with the arguments supplied to this builder.

        Returns:

        Newly created configuration.