PdfFragment

Fragment that actually displays the PDF document. It contains only the document view without any additional views like outline, thumbnail bar, search, etc. Meant to be used if you want full custom implementation and design.

Inheritors

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Factory methods and bundle argument keys for PdfFragment.

Properties

Link copied to clipboard

Returns the active annotation tool.

Link copied to clipboard

Returns the variant of the active annotation tool variant (if any).

Link copied to clipboard

Returns the AI Assistant provider associated with this fragment.

Link copied to clipboard

Returns annotation configuration registry with annotation configuration for supported annotation types and/or tools.

Link copied to clipboard
open override val annotationCreator: String

Returns the annotation creator name used when creating new annotations.

Link copied to clipboard

Returns manager for annotation preferences.

Link copied to clipboard

Background color of the fragment. It's the background of the area behind the pages.

Link copied to clipboard
open override val configuration: PdfConfiguration

Returns the configuration for this fragment.

Link copied to clipboard

Returns content editing fill color configuration

Link copied to clipboard

Returns manager for content editing preferences.

Link copied to clipboard
open val contentEditingState: ContentEditingState?

Returns the current content editing state.

Link copied to clipboard

The loaded document, or null if no document is loaded.

Link copied to clipboard

The document coordinator used for managing multiple documents.

Link copied to clipboard

Whether the annotation overlay is drawn above overlay views. By default, overlay views are drawn above the annotation overlay. Set this to true to allow overlaid annotations (for example, stamps rendered in overlay mode) to cover overlay views.

Link copied to clipboard

Whether the annotation overlay is enabled. When disabled, annotations rendered in overlay mode will be hidden. This does not affect annotations rendered directly on the page.

Link copied to clipboard

Indicates whether interaction with the document is enabled right now. When the interaction is disabled you can no longer scroll or zoom the document in any way; any other UI like the thumbnail bar is still enabled.

Link copied to clipboard

Returns true if any of the special modes is active.

Link copied to clipboard

Whether redaction annotations are previewed as redacted, false by default. When true, redaction annotations are shown as redacted; when false, they are shown as marks.

Link copied to clipboard

Whether scrolling performed by the user is enabled. Enabled by default.

Link copied to clipboard

Indicates whether UI is enabled right now. UI is disabled when document is being saved/loaded, or when manually disabled.

Link copied to clipboard

Whether zooming performed by the user is enabled. Enabled by default.

Link copied to clipboard

An editor object that allows you to add/delete/modify measurement scales MeasurementValueConfiguration Be aware that this is null until a PDFDocument is assigned to the fragment.

Link copied to clipboard

The annotations currently displayed in overlay mode.

Link copied to clipboard

Annotation types that should be rendered as overlays.

Link copied to clipboard
open override val pageCount: Int
Link copied to clipboard
open override var pageIndex: Int
Link copied to clipboard

Password view used for password-protected documents.

Link copied to clipboard
open override val recordedListener: OnEditRecordedListener

Returns the listener for recording edits for undo/redo functionality.

Link copied to clipboard

Returns a list of currently selected annotations, or an empty list if no annotations were selected.

Link copied to clipboard

Returns currently selected form element.

Link copied to clipboard

Steps into the built-in electronic signature flow before the signature dialog is shown and before a created signature is added to the document — for example to let the user pick a stroke thickness and opacity in a UI of your own, or to decide where the signature goes.

Link copied to clipboard

The currently used signature storage that will be used to store signatures when they're added to the document. If null, the default storage will be used by all the handlers.

Link copied to clipboard
open var state: Bundle

Gets current state of the fragment.

Link copied to clipboard

Returns the current text selection.

Link copied to clipboard

This fragment's undo manager instance for performing undo/redo operations of annotation edits.

Link copied to clipboard

Returns the ViewProjection for transforming between the view coordinates and PDF coordinates.

Link copied to clipboard
open val visiblePages: List<Int>

Fetch the list of pages currently visible on the screen.

Functions

Link copied to clipboard
open fun addAnnotationToPage(annotation: Annotation, selectImmediately: Boolean)
open fun addAnnotationToPage(annotation: Annotation, selectImmediately: Boolean, completeAction: Runnable?)

Adds annotation to page asynchronously, refreshing rendering in all UI components.

Link copied to clipboard

Adds an AnnotationViewsListener to the list of listeners that will be notified when the internal views factory creates an EditText widget for editing a FreeText annotation

Link copied to clipboard

Adds a DocumentActionListener that can handle actions bound to PDF objects. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard
open fun addDocumentListener(documentListener: DocumentListener)

Adds a DocumentListener for listening to document events. If the listener has already been added previously, this method will be a no-op. Listeners registered with this method will be unregistered automatically in .onDetach. Passing null is not allowed, and will result in an exception.

Link copied to clipboard
open fun addDocumentScrollListener(documentScrollListener: DocumentScrollListener)

Adds a DocumentScrollListener for listening to scrolling events on the document. If the listener has already been added previously, this method will be a no-op. Listeners registered with this method will be unregistered automatically in .onDetach. Passing null is not allowed, and will result in an exception.

Link copied to clipboard
open override fun addDrawableProvider(drawableProvider: PdfDrawableProvider)

Adds a PdfDrawableProvider to be managed by this object. If the provider has been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard
open fun addInsets(leftOffset: Int, topOffset: Int, rightOffset: Int, bottomOffset: Int)

Offset PdfFragment insets by specified amount.

Link copied to clipboard

Register a listener to get notified when annotation mode (creation or editing) changes. This is the recommended way to listen for annotation mode changes.

Register a OnAnnotatingModeSettingsChangeListener to get notified when annotation mode settings get updated.

Link copied to clipboard

Registers a listener to be notified when annotations are selected or deselected.

Link copied to clipboard

Registers a listener to be notified when annotations are updated.

Link copied to clipboard

Registers a listener to be notified when content editing content changes.

Link copied to clipboard

Registers a listener to be notified when content editing mode changes.

Link copied to clipboard

Adds a OnFormElementClickedListener to get notified when form element has been clicked. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Adds a OnFormElementDeselectedListener to get notified when form element gets deselected. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Adds a OnFormElementEditingModeChangeListener to get notified when form element editing mode gets updated. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Adds a OnFormElementSelectedListener to get notified when form element gets selected. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Adds a OnFormElementUpdatedListener to get notified when form element gets updated. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Adds a OnFormElementViewUpdatedListener to get notified about form element view update events. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Adds a OnTextFormElementSuggestionRequestListener to get notified when a text form element requests autocomplete suggestions. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Adds a OnTextSelectionChangeListener, which gets notified when text selection changes in the document, such as different text is selected. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Adds a OnTextSelectionModeChangeListener, which gets notified when entering and exiting a text selection in the document. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard
open fun addOverlayViewProvider(overlayViewProvider: OverlayViewProvider)

Adds an OverlayViewProvider for adding overlay views to this fragment. If the provider has been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard
open override fun beginNavigation()

Notifies the navigation manager that calls to setPageIndex should be added to the navigation history until endNavigation is called.

Link copied to clipboard

Clears all currently selected Annotations. This method may only be called on the main thread (UI thread).

Link copied to clipboard
open override fun endNavigation()

Commits the page changes to the navigation history dropping everything but the very last one.

Link copied to clipboard

Starts the annotating mode with the last used annotation tool as the selected one.

open override fun enterAnnotatingMode(annotationTool: AnnotationTool)

Enter annotation creation mode on the document. Once you invoke this method, you'll get AnnotatingController (through registered OnAnnotatingModeChangeListener) which provides methods for annotation creation with a specified type. Uses default AnnotationToolVariant.

open override fun enterAnnotatingMode(annotationTool: AnnotationTool, annotationToolVariant: AnnotationToolVariant)

Enter annotation creation mode on the document. Once you invoke this method, you'll get AnnotatingController (through registered OnAnnotatingModeChangeListener) which provides methods for annotation creation with a specified type.

Link copied to clipboard

Enter annotation creation mode on the document.

Enter annotation creation mode on the document with the given annotation tool.

open fun enterAnnotationCreationMode(annotationTool: AnnotationTool, annotationToolVariant: AnnotationToolVariant)

Enter annotation creation mode on the document with the given annotation tool and variant.

Link copied to clipboard

Enter annotation editing mode on the document. Once you invoke this method, you'll get AnnotatingController (through registered OnAnnotatingModeChangeListener) which provides methods for editing selected annotations. Notice: this method will not select annotation on the screen, for that use setSelectedAnnotation.

Enter annotation editing mode on the document. Once you invoke this method, you'll get AnnotatingController (through registered OnAnnotatingModeChangeListener) which provides methods for editing a selected annotation. Notice: this method will not select annotation on the screen, for that use setSelectedAnnotation.

Link copied to clipboard
open override fun enterContentEditingMode()

Starts the content editing mode which allows for modifying PDF content text

Link copied to clipboard
open override fun enterFormEditingMode(formElement: FormElement)

Enter form editing mode on the document. Once you invoke this method, you'll get FormEditingController (through registered OnFormElementEditingModeChangeListener) which provides methods for editing a selected form element. Notice: this method will not select form element on the screen, for that use setSelectedFormElement.

Link copied to clipboard
open override fun enterTextSelectionMode(@IntRange(from = 0) pageIndex: Int, textRange: Range)
open override fun enterTextSelectionMode(pageIndex: Int, touchedTextRects: TextSelectionRectangles)

Sets the current text selection. Once you invoke this method, you'll get TextSelectionController (through registered OnTextSelectionModeChangeListener) which provides methods for managing text selection actions.

Link copied to clipboard
open override fun executeAction(action: Action)
open override fun executeAction(action: Action, actionSender: ActionSender?)

Executes the given PDF action on the currently loaded document.

Link copied to clipboard
open override fun exitCurrentlyActiveMode()

Exit any currently active mode on the document (annotation creation, annotation editing, text selection).

Link copied to clipboard

Gets the annotation overlay render strategy for the specified annotation.

Link copied to clipboard

Returns this fragment's audio mode manager instance for entering/leaving audio playback or recording modes.

Link copied to clipboard

Returns this fragment's undo manager instance for performing undo/redo operations of content edits.

Link copied to clipboard

Returns the loaded image document, or null if this fragment does not hold an image document.

Link copied to clipboard

Returns the navigation history owned by this manager.

Link copied to clipboard
@IntRange(from = -1)
open override fun getPageCount(): Int

Gets number of pages in the document.

Link copied to clipboard
@IntRange(from = -1)
open override fun getPageIndex(): Int

Gets currently displayed document page.

Link copied to clipboard
@IntRange(from = -1)
open fun getSiblingPageIndex(@IntRange(from = -1) pageIndex: Int): Int

Gets page sibling index (usable in double page mode).

Link copied to clipboard
open fun getVisiblePdfRect(targetRect: RectF, @IntRange(from = 0) pageIndex: Int): Boolean

Sets targetRect to contain the visible PDF rect of the given pageIndex. If the pageIndex is not visible on the screen, targetRect won't be modified and the method will return false.

Link copied to clipboard
open fun getZoomScale(@IntRange(from = 0) pageIndex: Int): Float

Gets zoom scale at the specified page.

Link copied to clipboard

Hides the annotation selection popup toolbar if it is currently shown.

Link copied to clipboard
open fun highlight(context: Context, docRectFList: List<RectF>, pageIndex: Int)

Highlights the specified rectangles on the given page using the AI Assistant highlighter.

Link copied to clipboard
open fun invalidate()

Invalidates the Document view

Link copied to clipboard

Indicates whether the displayed document is an image or not.

Link copied to clipboard

Notifies this fragment that the passed annotation has changed and that all the views displaying it should be updated. Calling this method before document is loaded will have no effect. If you see annotations not rendering during zooming or page transitions, you probably need to call this function.

Link copied to clipboard

Notifies this fragment that the passed annotations have changed and that all the views displaying it should be updated. Calling this method before document is loaded will have no effect.

Link copied to clipboard

Notifies layout has changed and properly updates its internal state and views. Call this when PdfFragment is embedded in a ViewGroup that has changed its size, this will schedule a layout pass of the view tree, after views have been laid out.

Link copied to clipboard
open override fun onAnnotationDeselected(annotation: Annotation, reselected: Boolean)

Called when annotation gets deselected.

Link copied to clipboard
open override fun onAnnotationsCopied(annotations: List<Annotation>)

The following listener methods are called after successful operation. They might be called from a background thread, be careful when accessing the UI from there

Link copied to clipboard
open override fun onAnnotationsCut(annotations: List<Annotation>)

Called when annotations have been cut to the clipboard. Shows a toast notification indicating the annotations were cut.

Link copied to clipboard
open override fun onAnnotationSelected(annotation: Annotation, annotationCreated: Boolean)

Called when annotation gets selected.

Link copied to clipboard
open override fun onAnnotationSelectionFinished(annotations: List<Annotation>, annotationsCreated: Boolean)

Called when annotation gets selected.

Link copied to clipboard
open override fun onAnnotationsPasted(annotations: List<Annotation>)

Called when annotations have been pasted from the clipboard. Selects the pasted annotations and shows a toast notification.

Link copied to clipboard
open override fun onAttach(context: Context)

Called when the fragment is attached to an activity. Initializes weak references to document listeners and updates the activity context.

Link copied to clipboard
open override fun onConfigurationChanged(newConfig: Configuration)

Called when a device configuration change occurs while the fragment is running. Updates the layout and view coordinator to handle orientation or size changes.

Link copied to clipboard
open override fun onCreate(savedInstanceState: Bundle?)

Called when the fragment is created. Initializes the fragment configuration, document sources, and undo manager.

Link copied to clipboard
open override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?

Called to create and return the view hierarchy for this fragment. Creates the PDF document view with configuration settings from the theme.

Link copied to clipboard
open override fun onDestroy()

Called when the fragment is being destroyed. Releases document resources and cleans up internal state.

Link copied to clipboard
open override fun onDestroyView()

Called when the view previously created by onCreateView is being destroyed. Cleans up view-related resources and listeners.

Link copied to clipboard
open override fun onDetach()

Called when the fragment is detached from its host activity. Clears the activity context reference.

Link copied to clipboard
open override fun onDocumentClick(): Boolean

Called when the user taps / clicks on the document, not the page itself but on the side (if visible).

Link copied to clipboard
open override fun onDocumentLoaded(document: PdfDocument)

Called when document is successfully loaded and the document view has been laid out. This has to be called on the main thread.

Link copied to clipboard
open override fun onDocumentSave(document: PdfDocument, saveOptions: DocumentSaveOptions): Boolean

Called before document will be saved. Allows cancellation of the save process.

Link copied to clipboard
open override fun onDocumentSaveCancelled(document: PdfDocument)

Called if document saving has been cancelled.

Link copied to clipboard
open override fun onDocumentSaved(document: PdfDocument)

Called after the document has been saved.

Link copied to clipboard
open override fun onDocumentSaveFailed(document: PdfDocument, exception: Throwable)

Called if document saving has failed.

Link copied to clipboard
open override fun onDocumentScrolled(currX: Int, currY: Int, maxX: Int, maxY: Int, extendX: Int, extendY: Int)

Called whenever the document in the fragment scrolled. Values are expressed in an arbitrary unit and may change with every call. Also maxX and maxY are not guaranteed to remain the same between two calls.

Link copied to clipboard
open override fun onDocumentZoomed(document: PdfDocument, @IntRange(from = 0) pageIndex: Int, scaleFactor: Float)

Called when a user zooms a document.

Link copied to clipboard
open override fun onFormElementDeselected(formElement: FormElement, reselected: Boolean)

Called when form element gets deselected.

Link copied to clipboard
open override fun onFormElementSelected(formElement: FormElement)

Called when form element gets selected.

Link copied to clipboard
open override fun onPageChanged(document: PdfDocument, @IntRange(from = 0) pageIndex: Int)

Called when user scrolled to a new page.

Link copied to clipboard
open override fun onPageClick(document: PdfDocument, @IntRange(from = 0) pageIndex: Int, event: MotionEvent?, pagePosition: PointF?, clickedAnnotation: Annotation?): Boolean

Called when user taps / clicks on the page.

Link copied to clipboard
open override fun onPageUpdated(document: PdfDocument, @IntRange(from = 0) pageIndex: Int)

Called when content of page with pageIndex has changed (for example due to annotation or form field being updated). All views displaying this page need to refresh.

Link copied to clipboard
open override fun onPrepareAnnotationSelection(controller: AnnotationSelectionController, annotation: Annotation, annotationCreated: Boolean): Boolean

Called immediately before annotation is going to be selected.

Link copied to clipboard
open override fun onResume()

Called when the fragment is visible to the user and actively running. Resumes document rendering and processes pending annotations.

Link copied to clipboard
open override fun onSaveInstanceState(outState: Bundle)

Called by the activity if it requires the fragment to save its state. Since this method can also be called when the fragment is on the backstack and has no view, this method may not rely on any views being present at the time of calling.

Link copied to clipboard
open override fun onScrollStateChanged(state: ScrollState)

Called whenever the current scroll state of the document view has changed.

Link copied to clipboard
open override fun onStop()

Called when the fragment is no longer visible to the user. Pauses rendering and optionally saves the document based on configuration.

Link copied to clipboard
open override fun onViewCreated(view: View, savedInstanceState: Bundle?)

Called after the view has been created. Initializes the document view and starts document loading if not already started.

Link copied to clipboard
open fun refreshPages()

Re initialises DocumentView if total number of visible pages are 0. This is useful when the document is loaded but the pages are cleared for example when this is used in a ViewPager.

Link copied to clipboard

Removes a listener from the list of AnnotationViewsListeners.

Link copied to clipboard

Removes a previously added DocumentActionListener that can handle actions bound to PDF objects. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard
open fun removeDocumentListener(documentListener: DocumentListener)

Removes a previously registered DocumentListener. After calling this method the documentListener will stop receiving document events. If the listener has not been added previously, this method will be a no-op. Passingnull is not allowed, and will result in an exception.

Link copied to clipboard
open fun removeDocumentScrollListener(documentScrollListener: DocumentScrollListener)

Removes a previously registered DocumentScrollListener. After calling this method the documentScrollListener will stop receiving scrolling events. If the listener has not been added previously, this method will be a no-op. Passingnull is not allowed, and will result in an exception.

Link copied to clipboard
open override fun removeDrawableProvider(drawableProvider: PdfDrawableProvider)

Removes a previously added PdfDrawableProvider. If the provider hasn't been added previously, this method will be a no-op.

Link copied to clipboard

Removes a previously registered annotation selection listener.

Link copied to clipboard

Removes a previously registered annotation update listener.

Removes a previously registered content editing content change listener.

Link copied to clipboard

Removes a previously registered content editing mode change listener.

Link copied to clipboard

Removes a previously registered OnFormElementClickedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed,and will result in an exception.

Link copied to clipboard

Removes a previously registered OnFormElementDeselectedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed,and will result in an exception.

Removes a previously registered OnFormElementEditingModeChangeListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed,and will result in an exception.

Link copied to clipboard

Removes a previously registered OnFormElementSelectedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed,and will result in an exception.

Link copied to clipboard

Removes a previously registered OnFormElementUpdatedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed,and will result in an exception.

Link copied to clipboard

Removes a previously registered OnFormElementViewUpdatedListener. Upon calling this method the listener will no longer be notified of any changes. If the listener has not been added, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Removes a previously registered OnTextFormElementSuggestionRequestListener. Upon calling this method the listener will no longer be notified of any requests. If the listener has not been added, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Link copied to clipboard

Removes a OnTextSelectionChangeListener, which gets notified when text selection changes in the document, such as different text is selected. Upon calling this method the listener will no longer be notified. If the listener has not been added, this method will be a no-op.

Link copied to clipboard

Removes a previously added OnTextSelectionModeChangeListener, which gets notified when entering and exiting a text selection in the document. Upon calling this method the listener will no longer be notified. If the listener has not been added, this method will be a no-op.

Link copied to clipboard
open fun removeOverlayViewProvider(overlayViewProvider: OverlayViewProvider)

Removes a previously added OverlayViewProvider. If the provider hasn't been added previously, this method will be a no-op.

Link copied to clipboard
open fun save(): Boolean

Saves the file held by the document view back to its original location. The save operation will be successful only if all document listeners return true in DocumentListener.onDocumentSave and the document was actually modified.

Link copied to clipboard
open fun saveAsync()

Saves the file held by the document view back to its original location. The save operation will be successful only if all document listeners return true in DocumentListener.onDocumentSave and the document was actually modified.

Link copied to clipboard
open fun scrollTo(pdfRect: RectF, @IntRange(from = 0) pageIndex: Int, duration: Long, scrollWhenVisible: Boolean)

Scrolls to the given pdfRect, if necessary changing to the page. This will keep the current zoom level. If scrollWhenVisible is false this method will be a no-op if the pdfRect is already completely visible.

Link copied to clipboard

Sets the annotation overlay render strategy. This strategy defines how annotations that are displayed in overlay mode (i.e. views which are rendered as views inside the activities view hierarchy) should be rendered. By default, Nutrient uses AnnotationOverlayRenderStrategy.Strategy.PLATFORM_RENDERING for all annotations. You can override this behavior by setting a custom strategy using this method. For more information about the available render strategies please see AnnotationOverlayRenderStrategy.

Link copied to clipboard

Sets the custom source for the PDF file.

Link copied to clipboard

Sets the custom sources for the PDF file. Can be used to load a different - or reload the same - document into the Fragment. The fragment will not be destroyed by this operation.

Link copied to clipboard
open fun setInsets(@IntRange(from = 0) left: Int, @IntRange(from = 0) top: Int, @IntRange(from = 0) right: Int, @IntRange(from = 0) bottom: Int)

Sets insets that will be used as padding for PdfFragment contents.

Link copied to clipboard

Sets a OnDocumentLongPressListener for long press document events. Listener registered with this method will be unregistered automatically in .onDetach. Calling this method will replace any previously set listener. You may provide null to switch to the default listener.

Link copied to clipboard

Sets the listener that will allow you to get notified when each of the popup toolbars is prepared and ready to be displayed. This allows you to set your own items, change the appearance of the toolbar, etc.

Link copied to clipboard

Sets the listener notified when critical native memory pressure persists despite the SDK's automatic recovery (cache trimming, render abort and backoff). Transient pressure episodes recover silently and never invoke the listener; once it does fire, the recommended response is to release this document — finish the host activity, replace the document, or remove the fragment.

Link copied to clipboard
open override fun setPageIndex(@IntRange(from = 0) pageIndex: Int)

Sets the pageIndex to be displayed (0 is the first one), using our default decision on animating, which is to animate the transition if the page is next/before the current page, and not animate if further away. For custom animation control , use setPageIndex.

open override fun setPageIndex(@IntRange(from = 0) pageIndex: Int, animated: Boolean)

Sets the pageIndex to be displayed (0 is the first one). If animated is set to true, the page jump will be animated. If false, the page will be shown immediately.

Link copied to clipboard
open fun setPageLoadingDrawable(drawable: Drawable?)

Sets drawable that should be displayed instead of fragment's contents (i.e. loading throbber) until document is loaded and all visible pages are rendered.

Link copied to clipboard

Selects a single Annotation. This will also start annotation editing mode with selected annotation being edited.

Link copied to clipboard

Sets the currently selected Annotations.

Link copied to clipboard

Sets the currently selected FormElement.

Link copied to clipboard

For measurement tools, you can set and select whichever MeasurementValueConfiguration you want using this API. This will set what com.pspdfkit.annotations.measurements.Scale and com.pspdfkit.annotations.measurements.MeasurementPrecision you want to use.

Link copied to clipboard

Shows the annotation selection popup toolbar for the currently selected annotations. This can be used after calling .setSelectedAnnotations to programmatically display the popup toolbar. Does nothing if no annotations are selected, if the popup toolbar is disabled in the configuration, or if the page editor is not yet available.

Link copied to clipboard
open fun zoomBy(focusX: Int, focusY: Int, @IntRange(from = 0) pageIndex: Int, scaleFactor: Float, duration: Long)

Zoom by the given scale focused on the given point in PDF coordinates.`

Link copied to clipboard
open fun zoomTo(rect: RectF?, @IntRange(from = 0) pageIndex: Int, duration: Long)

Zoom to a specific rect on the given page.

open fun zoomTo(focusX: Int, focusY: Int, @IntRange(from = 0) pageIndex: Int, targetScale: Float, duration: Long)

Zoom to the given scale focused on the given point in PDF coordinates.