| java.lang.Object | ||
| ↳ | androidx.fragment.app.Fragment | |
| ↳ | com.pspdfkit.ui.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.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| float | DEFAULT_ZOOM | Default zoom scale. | |||||||||
| String | DOCUMENTSTORE_KEY_LAST_VIEWED_PAGE_INDEX | Key for storing the last viewed page index inside the DocumentDataStore of the loaded document. | |||||||||
| float | MAX_ZOOM | Maximum zoom scale. | |||||||||
| float | MIN_ZOOM | Min allowed zoom (before snapping back). | |||||||||
| String | PARAM_CONFIGURATION | ||||||||||
| String | PARAM_IMAGE_DOCUMENT_SOURCE | ||||||||||
| String | PARAM_SOURCES | ||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| public static final int | DOCUMENT_VIEW_ID | ||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
addAnnotationToPage(Annotation annotation, boolean selectImmediately, Runnable completeAction)
Adds annotation to page asynchronously, refreshing rendering in all UI components.
| ||||||||||
| void |
addAnnotationToPage(Annotation annotation, boolean selectImmediately)
Adds annotation to page asynchronously, refreshing rendering in all UI components.
| ||||||||||
| void |
addDocumentActionListener(DocumentActionListener listener)
Adds a
DocumentActionListener that can handle actions bound to PDF objects. | ||||||||||
| void |
addDocumentListener(DocumentListener documentListener)
Adds a
DocumentListener for listening to document events. | ||||||||||
| void |
addDocumentScrollListener(DocumentScrollListener documentScrollListener)
Adds a
DocumentScrollListener for listening to scrolling events on the document. | ||||||||||
| void |
addDrawableProvider(PdfDrawableProvider drawableProvider)
Adds a
PdfDrawableProvider to be managed by this object. | ||||||||||
| void |
addInsets(int leftOffset, int topOffset, int rightOffset, int bottomOffset)
Offset
PdfFragment insets by specified amount. | ||||||||||
| void |
addOnAnnotationCreationModeChangeListener(AnnotationManager.OnAnnotationCreationModeChangeListener listener)
Register a
AnnotationManager.OnAnnotationCreationModeChangeListener to get notified when annotation creation mode gets updated. | ||||||||||
| void |
addOnAnnotationCreationModeSettingsChangeListener(AnnotationManager.OnAnnotationCreationModeSettingsChangeListener listener)
Register a
AnnotationManager.OnAnnotationCreationModeSettingsChangeListener to get notified when annotation creation settings get updated. | ||||||||||
| void |
addOnAnnotationDeselectedListener(AnnotationManager.OnAnnotationDeselectedListener listener)
Register a
AnnotationManager.OnAnnotationDeselectedListener to get notified when annotation gets deselected. | ||||||||||
| void |
addOnAnnotationEditingModeChangeListener(AnnotationManager.OnAnnotationEditingModeChangeListener listener)
Register a
AnnotationManager.OnAnnotationEditingModeChangeListener to get notified when annotation editing mode gets updated. | ||||||||||
| void |
addOnAnnotationSelectedListener(AnnotationManager.OnAnnotationSelectedListener listener)
Register a
AnnotationManager.OnAnnotationSelectedListener to get notified when annotation gets selected. | ||||||||||
| void |
addOnAnnotationUpdatedListener(AnnotationProvider.OnAnnotationUpdatedListener listener)
Register a
AnnotationProvider.OnAnnotationUpdatedListener to get notified when annotation gets updated. | ||||||||||
| void |
addOnFormElementClickedListener(FormManager.OnFormElementClickedListener listener)
Adds a
FormManager.OnFormElementClickedListener to get notified when form element has been clicked. | ||||||||||
| void |
addOnFormElementDeselectedListener(FormManager.OnFormElementDeselectedListener listener)
Adds a
FormManager.OnFormElementDeselectedListener to get notified when form element gets deselected. | ||||||||||
| void |
addOnFormElementEditingModeChangeListener(FormManager.OnFormElementEditingModeChangeListener listener)
Adds a
FormManager.OnFormElementEditingModeChangeListener to get notified when form element editing mode gets updated. | ||||||||||
| void |
addOnFormElementSelectedListener(FormManager.OnFormElementSelectedListener listener)
Adds a
FormManager.OnFormElementSelectedListener to get notified when form element gets selected. | ||||||||||
| void |
addOnFormElementUpdatedListener(FormManager.OnFormElementUpdatedListener listener)
Adds a
FormManager.OnFormElementUpdatedListener to get notified when form element gets updated. | ||||||||||
| void |
addOnFormElementViewUpdatedListener(FormManager.OnFormElementViewUpdatedListener listener)
Adds a
FormManager.OnFormElementViewUpdatedListener to get notified about form element view update events. | ||||||||||
| void |
addOnTextSelectionChangeListener(TextSelectionManager.OnTextSelectionChangeListener listener)
Adds a
TextSelectionManager.OnTextSelectionChangeListener,
which gets notified when text selection changes in the document, such as different text is selected. | ||||||||||
| void |
addOnTextSelectionModeChangeListener(TextSelectionManager.OnTextSelectionModeChangeListener listener)
Adds a
TextSelectionManager.OnTextSelectionModeChangeListener,
which gets notified when entering and exiting a text selection in the document. | ||||||||||
| void |
beginNavigation()
Notifies the navigation manager that calls to
setPageIndex(int, boolean) should be added to
the navigation history until endNavigation() is called. | ||||||||||
| boolean |
clearSelectedAnnotations()
Clears all currently selected
Annotations. | ||||||||||
| void |
convertPdfPointToViewPoint(PointF point, int pageIndex, boolean includeViewScroll)
Converts the coordinates stored within
point from the PDF coordinate space of the given pageIndex
to the view coordinate space (i.e. | ||||||||||
| void |
convertPdfPointToViewPoint(PointF point, int pageIndex)
Converts the coordinates stored within
point from the PDF coordinate space of the given pageIndex
to the view coordinate space (i.e. | ||||||||||
| void |
convertPdfRectToViewRect(RectF rect, int pageIndex)
Converts the PDF coordinates stored in
rect (of the given pageIndex) to view coordinates. | ||||||||||
| void |
convertViewPointToPdfPoint(PointF point, int pageIndex)
Converts the coordinates stored within
point from the view coordinate space (i.e. | ||||||||||
| void |
convertViewRectToPdfRect(RectF rect, int pageIndex)
Converts the view coordinates stored in
rect to PDF coordinates on the given pageIndex. | ||||||||||
| void |
endNavigation()
Commits the page changes to the navigation history dropping everything but the very last one.
| ||||||||||
| void |
enterAnnotationCreationMode()
Starts the annotation creation mode with the last used annotation tool as the selected one.
| ||||||||||
| void |
enterAnnotationCreationMode(AnnotationTool annotationTool)
Enter annotation creation mode on the document.
| ||||||||||
| void |
enterAnnotationEditingMode(Annotation annotation)
Enter annotation editing mode on the document.
| ||||||||||
| void | enterFormEditingMode(FormElement formElement) | ||||||||||
| void |
enterTextSelectionMode(int pageIndex, Range textRange)
Sets the current text selection.
| ||||||||||
| void |
executeAction(Action action, ActionSender actionSender)
Executes the given PDF
action on the currently loaded document. | ||||||||||
| void |
executeAction(Action action)
Executes the given PDF
action on the currently loaded document. | ||||||||||
| void |
exitCurrentlyActiveMode()
Exit any currently active mode on the document (annotation creation, annotation editing, text selection).
| ||||||||||
| AnnotationDefaultsManager |
getAnnotationDefaults()
Returns manager for annotation defaults.
| ||||||||||
| AnnotationPreferencesManager |
getAnnotationPreferences()
Returns manager for annotation preferences.
| ||||||||||
| int |
getBackgroundColor()
Gets the background color of the fragment.
| ||||||||||
| PdfConfiguration |
getConfiguration()
Returns configuration for this PdfFragment.
| ||||||||||
| PdfDocument |
getDocument()
Get the loaded document.
| ||||||||||
| ImageDocument |
getImageDocument()
Returns the loaded image document, or
null if this fragment does not hold an image document. | ||||||||||
| NavigationBackStack<NavigationItem<Integer>> |
getNavigationHistory()
Returns the navigation history owned by this manager.
| ||||||||||
| EnumSet<AnnotationType> |
getOverlaidAnnotationTypes()
Gets annotation types that should be rendered as overlays.
| ||||||||||
| List<Annotation> |
getOverlaidAnnotations()
Gets annotations that should be rendered as overlays.
| ||||||||||
| int |
getPageCount()
Gets number of pages in the document.
| ||||||||||
| int |
getPageIndex()
Get currently displayed document page.
| ||||||||||
| Matrix |
getPageToViewTransformation(int pageIndex, Matrix reuse, boolean includeViewScroll)
Returns a transformation matrix for converting page coordinates (for the given
pageIndex) to view
coordinates (relative to the fragment itself). | ||||||||||
| Matrix |
getPageToViewTransformation(int pageIndex, Matrix reuse)
Returns a transformation matrix for converting page coordinates (for the given
pageIndex) to view
coordinates (relative to the fragment itself). | ||||||||||
| PdfPasswordView |
getPasswordView()
Returns currently set password view for the fragment.
| ||||||||||
| List<Annotation> |
getSelectedAnnotations()
Returns a list of currently selected annotations, or an empty list if no annotations were selected.
| ||||||||||
| FormElement |
getSelectedFormElement()
Returns currently selected form element.
| ||||||||||
| int |
getSiblingPageIndex(int pageIndex)
Get page sibling index (usable in double page mode).
| ||||||||||
| SignatureMetadata |
getSignatureMetadata()
Gets the currently set signature metadata.
| ||||||||||
| SignatureStorage |
getSignatureStorage()
Gets the currently used signature storage that will be used to store signatures when they're added to the
document.
| ||||||||||
| Bundle |
getState()
Get current state of the fragment.
| ||||||||||
| TextSelection |
getTextSelection()
Returns the current text selection.
| ||||||||||
| UndoManager |
getUndoManager()
Returns this fragment's undo manager instance for performing undo/redo operations of edits.
| ||||||||||
| List<Integer> |
getVisiblePages()
Fetch the list of pages currently visible on the screen.
| ||||||||||
| boolean |
getVisiblePdfRect(RectF targetRect, int pageIndex)
Sets
targetRect to contain the visible PDF rect of the given pageIndex. | ||||||||||
| float |
getZoomScale(int pageIndex)
Get zoom scale at the specified page.
| ||||||||||
| boolean |
isDocumentInteractionEnabled()
Indicates whether interaction with the document is enabled right now.
| ||||||||||
| boolean |
isImageDocument()
Indicates whether the displayed document is an image or not.
| ||||||||||
| boolean |
isInSpecialMode()
Returns
true if any of the special modes is active. | ||||||||||
| boolean |
isRedactionAnnotationPreviewEnabled()
Returns redaction annotation preview mode,
false by default. | ||||||||||
| boolean |
isScrollingEnabled()
Indicates whether the scrolling is enabled, or not.
| ||||||||||
| boolean |
isUserInterfaceEnabled()
Indicates whether UI is enabled right now.
| ||||||||||
| boolean |
isZoomingEnabled()
Indicates whether the zooming is enabled, or not.
| ||||||||||
| static PdfFragment |
newImageInstance(Uri documentUri, PdfConfiguration configuration)
Creates and returns a new Fragment to display a converted PDF document from a supported image format.
| ||||||||||
| static PdfFragment |
newImageInstance(DocumentSource source, PdfConfiguration configuration)
Creates and returns a new Fragment to display a converted PDF document from a supported image format.
| ||||||||||
| static PdfFragment |
newImageInstance(DataProvider source, PdfConfiguration configuration)
Creates and returns a new Fragment to display a converted PDF document from a supported image format.
| ||||||||||
| static PdfFragment |
newInstance(PdfFragment fragment, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from an
PdfFragment. | ||||||||||
| static PdfFragment |
newInstance(List<Uri> documentUris, PdfConfiguration configuration)
Creates and returns a new Fragment to display passed list of PDF documents as a single compound document.
| ||||||||||
| static PdfFragment |
newInstance(List<Uri> documentUris, List<String> documentPasswords, PdfConfiguration configuration)
Creates and returns a new Fragment to display passed list of PDF documents as a single compound document.
| ||||||||||
| static PdfFragment |
newInstance(DataProvider source, String password, String contentSignature, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from a custom data source
| ||||||||||
| static PdfFragment |
newInstance(List<Uri> documentUris, List<String> documentPasswords, List<String> documentContentSignatures, PdfConfiguration configuration)
Creates and returns a new Fragment to display passed list of PDF documents as a single compound document.
| ||||||||||
| static PdfFragment |
newInstance(DataProvider source, String password, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from a custom data source.
| ||||||||||
| static PdfFragment |
newInstance(PdfDocument document, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from an already opened
PdfDocument instance. | ||||||||||
| static PdfFragment |
newInstance(Uri documentUri, String password, String contentSignature, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document.
| ||||||||||
| static PdfFragment |
newInstance(Uri documentUri, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document.
| ||||||||||
| static PdfFragment |
newInstance(Uri documentUri, String password, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document.
| ||||||||||
| static PdfFragment |
newInstanceFromDocumentSources(List<DocumentSource> sources, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from the given DocumentSources.
| ||||||||||
| static PdfFragment |
newInstanceFromSources(List<DataProvider> sources, List<String> passwords, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from a custom data source as a compound document.
| ||||||||||
| static PdfFragment |
newInstanceFromSources(List<DataProvider> sources, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from a custom data source as a compound document.
| ||||||||||
| static PdfFragment |
newInstanceFromSources(List<DataProvider> sources, List<String> passwords, List<String> contentSignatures, PdfConfiguration configuration)
Creates and returns a new Fragment to display a PDF document from a custom data source as a compound document.
| ||||||||||
| void |
notifyAnnotationHasChanged(Annotation annotation)
Notifies this fragment that the passed annotation has changed and that all the views displaying it should be
updated.
| ||||||||||
| void |
notifyLayoutChanged()
Notifies layout has changed and properly updates its internal state and views.
| ||||||||||
| void | onActivityCreated(Bundle savedInstanceState) | ||||||||||
| void |
onAnnotationDeselected(Annotation annotation, boolean reselected)
Called when annotation gets deselected.
| ||||||||||
| void |
onAnnotationSelected(Annotation annotation, boolean annotationCreated)
Called when annotation gets selected.
| ||||||||||
| void | onAttach(Context context) | ||||||||||
| void | onConfigurationChanged(Configuration newConfig) | ||||||||||
| void | onCreate(Bundle savedInstanceState) | ||||||||||
| View | onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) | ||||||||||
| void | onDestroy() | ||||||||||
| void | onDestroyView() | ||||||||||
| void | onDetach() | ||||||||||
| boolean |
onDocumentClick()
Called when the user taps / clicks on the document, not the page itself but on the side (if visible).
| ||||||||||
| void |
onDocumentLoadFailed(Throwable exception)
Called if document loading has failed.
| ||||||||||
| void |
onDocumentLoaded(PdfDocument document)
Called when document is successfully loaded and the document view has been laid out.
| ||||||||||
| boolean |
onDocumentSave(PdfDocument document, DocumentSaveOptions saveOptions)
Called before document will be saved.
| ||||||||||
| void |
onDocumentSaveCancelled(PdfDocument document)
Called if document saving has been cancelled.
| ||||||||||
| void |
onDocumentSaveFailed(PdfDocument document, Throwable exception)
Called if document saving has failed.
| ||||||||||
| void |
onDocumentSaved(PdfDocument document)
Called after the document has been saved.
| ||||||||||
| void |
onDocumentScrolled(PdfFragment fragment, int currX, int currY, int maxX, int maxY, int extendX, int extendY)
Called whenever the document in the fragment scrolled.
| ||||||||||
| void |
onDocumentZoomed(PdfDocument document, int pageIndex, float scaleFactor)
Called when a user zooms a document.
| ||||||||||
| void |
onFormElementDeselected(FormElement formElement, boolean reselected)
Called when form element gets deselected.
| ||||||||||
| void |
onFormElementSelected(FormElement formElement)
Called when form element gets selected.
| ||||||||||
| void | onLowMemory() | ||||||||||
| void |
onPageChanged(PdfDocument document, int pageIndex)
Called when user scrolled to a new page.
| ||||||||||
| boolean |
onPageClick(PdfDocument document, int pageIndex, MotionEvent event, PointF pagePosition, Annotation clickedAnnotation)
Called when user taps / clicks on the page.
| ||||||||||
| void |
onPageUpdated(PdfDocument document, int pageIndex)
Called when content of page with pageIndex has changed (for example due to annotation or form field being
updated).
| ||||||||||
| boolean |
onPrepareAnnotationSelection(AnnotationSelectionController controller, Annotation annotation, boolean annotationCreated)
Called immediately before annotation is going to be selected.
| ||||||||||
| void | onResume() | ||||||||||
| void |
onSaveInstanceState(Bundle outState)
Called by the activity if it requires the fragment to save its state.
| ||||||||||
| void |
onScrollStateChanged(PdfFragment fragment, ScrollState state)
Called whenever the current scroll state of the
PdfFragment changed. | ||||||||||
| void | onStop() | ||||||||||
| void |
removeDocumentActionListener(DocumentActionListener listener)
Removes a previously added
DocumentActionListener that can handle actions bound to PDF objects. | ||||||||||
| void |
removeDocumentListener(DocumentListener documentListener)
Removes a previously registered
DocumentListener. | ||||||||||
| void |
removeDocumentScrollListener(DocumentScrollListener documentScrollListener)
Removes a previously registered
DocumentScrollListener. | ||||||||||
| void |
removeDrawableProvider(PdfDrawableProvider drawableProvider)
Removes a previously added
PdfDrawableProvider. | ||||||||||
| void |
removeOnAnnotationCreationModeChangeListener(AnnotationManager.OnAnnotationCreationModeChangeListener listener)
Remove a previously registered
AnnotationManager.OnAnnotationCreationModeChangeListener. | ||||||||||
| void |
removeOnAnnotationCreationModeSettingsChangeListener(AnnotationManager.OnAnnotationCreationModeSettingsChangeListener listener)
Remove a previously registered
AnnotationManager.OnAnnotationCreationModeSettingsChangeListener. | ||||||||||
| void |
removeOnAnnotationDeselectedListener(AnnotationManager.OnAnnotationDeselectedListener listener)
Remove a previously registered
AnnotationManager.OnAnnotationDeselectedListener. | ||||||||||
| void |
removeOnAnnotationEditingModeChangeListener(AnnotationManager.OnAnnotationEditingModeChangeListener listener)
Remove a previously registered
AnnotationManager.OnAnnotationEditingModeChangeListener. | ||||||||||
| void |
removeOnAnnotationSelectedListener(AnnotationManager.OnAnnotationSelectedListener listener)
Remove a previously registered
AnnotationManager.OnAnnotationSelectedListener. | ||||||||||
| void |
removeOnAnnotationUpdatedListener(AnnotationProvider.OnAnnotationUpdatedListener listener)
Remove a previously registered
AnnotationProvider.OnAnnotationUpdatedListener. | ||||||||||
| void |
removeOnFormElementClickedListener(FormManager.OnFormElementClickedListener listener)
Removes a previously registered
FormManager.OnFormElementClickedListener. | ||||||||||
| void |
removeOnFormElementDeselectedListener(FormManager.OnFormElementDeselectedListener listener)
Removes a previously registered
FormManager.OnFormElementDeselectedListener. | ||||||||||
| void |
removeOnFormElementEditingModeChangeListener(FormManager.OnFormElementEditingModeChangeListener listener)
Removes a previously registered
FormManager.OnFormElementEditingModeChangeListener. | ||||||||||
| void |
removeOnFormElementSelectedListener(FormManager.OnFormElementSelectedListener listener)
Removes a previously registered
FormManager.OnFormElementSelectedListener. | ||||||||||
| void |
removeOnFormElementUpdatedListener(FormManager.OnFormElementUpdatedListener listener)
Removes a previously registered
FormManager.OnFormElementUpdatedListener. | ||||||||||
| void |
removeOnFormElementViewUpdatedListener(FormManager.OnFormElementViewUpdatedListener listener)
Removes a previously registered
FormManager.OnFormElementViewUpdatedListener. | ||||||||||
| void |
removeOnTextSelectionChangeListener(TextSelectionManager.OnTextSelectionChangeListener listener)
Removes a
TextSelectionManager.OnTextSelectionChangeListener,
which gets notified when text selection changes in the document, such as different text is selected. | ||||||||||
| void |
removeOnTextSelectionModeChangeListener(TextSelectionManager.OnTextSelectionModeChangeListener listener)
Removes a previously added
TextSelectionManager.OnTextSelectionModeChangeListener,
which gets notified when entering and exiting a text selection in the document. | ||||||||||
| void |
save()
Saves the file held by the document view back to it's original location.
| ||||||||||
| void |
scrollTo(RectF pdfRect, int pageIndex, long duration, boolean scrollWhenVisible)
Scrolls to the given
pdfRect, if necessary changing to the page. | ||||||||||
| void |
setAnnotationDefaultsProvider(AnnotationType annotationType, AnnotationDefaultsProvider defaultsProvider)
Configures annotation defaults provider for given annotation type.
| ||||||||||
| void |
setBackgroundColor(int backgroundColor)
Sets the background color of the fragment.
| ||||||||||
| void |
setCustomPdfSource(DocumentSource source)
Sets the custom source for the PDF file.
| ||||||||||
| void |
setCustomPdfSources(List<DocumentSource> sources)
Sets the custom sources for the PDF file.
| ||||||||||
| void |
setDocumentInteractionEnabled(boolean isDocumentInteractionEnabled)
Enables or disables interaction with the document.
| ||||||||||
| void |
setDocumentSigningListener(DocumentSigningListener documentSigningListener)
Sets a new
DocumentSigningListener or replaces an existing one. | ||||||||||
| void |
setInsets(int left, int top, int right, int bottom)
Set insets that will be used as padding for
PdfFragment contents. | ||||||||||
| void |
setOnDocumentLongPressListener(OnDocumentLongPressListener listener)
Set a
OnDocumentLongPressListener for long press document events. | ||||||||||
| void |
setOnPreparePopupToolbarListener(OnPreparePopupToolbarListener listener)
Sets the listener that will allow you to get notified when each of the popup toolbars is prepared and ready to be
displayed.
| ||||||||||
| void |
setOverlaidAnnotationTypes(EnumSet<AnnotationType> overlayAnnotationTypes)
Sets annotation types that should be rendered as overlays.
| ||||||||||
| void |
setOverlaidAnnotations(List<Annotation> overlayAnnotations)
Sets annotations that should be rendered as overlays.
| ||||||||||
| void |
setPageIndex(int pageIndex)
Sets the | ||||||||||
| void |
setPageIndex(int pageIndex, boolean animated)
Sets the | ||||||||||
| void |
setPageLoadingDrawable(Drawable drawable)
Sets drawable that should be displayed instead of fragment's contents (i.e.
| ||||||||||
| void |
setPasswordView(PdfPasswordView pdfPasswordView)
Sets password view to be used for the password-protected documents.
| ||||||||||
| void |
setRedactionAnnotationPreviewEnabled(boolean enable)
Sets redaction annotations preview as redacted.
| ||||||||||
| void |
setScrollingEnabled(boolean enabled)
Enables/disabled the scrolling performed by the user.
| ||||||||||
| void |
setSelectedAnnotation(Annotation annotation)
Selects a single
Annotation. | ||||||||||
| void |
setSelectedAnnotations(Collection<Annotation> annotations)
Sets the currently selected
Annotations. | ||||||||||
| void |
setSelectedFormElement(FormElement formElement)
Sets the currently selected
FormElement. | ||||||||||
| void |
setSignatureMetadata(SignatureMetadata signatureMetadata)
Sets the signature metadata that will be used when digitally signing the document.
| ||||||||||
| void |
setSignatureStorage(SignatureStorage signatureStorage)
Sets the signature storage that will be used to store signatures when they're added to the document (if saving
signatures is enabled).
| ||||||||||
| void |
setState(Bundle state)
Replace fragment state.
| ||||||||||
| void |
setUserInterfaceEnabled(boolean isUserInterfaceEnabled)
Enables or disables the user interface.
| ||||||||||
| void |
setZoomingEnabled(boolean enabled)
Enables/disabled the zooming performed by the user.
| ||||||||||
| void |
zoomBy(int focusX, int focusY, int pageIndex, float scaleFactor, long duration)
Zoom by the given scale focused on the given point in PDF coordinates.`
| ||||||||||
| void |
zoomTo(int focusX, int focusY, int pageIndex, float targetScale, long duration)
Zoom to the given scale focused on the given point in PDF coordinates.
| ||||||||||
| void |
zoomTo(RectF rect, int pageIndex, long duration)
Zoom to a specific rect on the given page.
| ||||||||||
Default zoom scale.
Key for storing the last viewed page index inside the DocumentDataStore of the loaded document. The last
viewed page index is only read or written if isLastViewedPageRestorationEnabled() is set
to true. If page restoration is disabled, the fragment won't access or modify the document store and any
previously written value. The value is saved to the store inside onStop().
Maximum zoom scale.
Min allowed zoom (before snapping back).
Adds annotation to page asynchronously, refreshing rendering in all UI components.
| annotation | The Annotation to add. |
|---|---|
| selectImmediately | True when annotation should be selected for editing immediately after being added to the
page. This also enters annotation editing mode via enterAnnotationEditingMode(Annotation). |
| completeAction | Action that should be executed immediately after annotation has been added to the page. |
Adds annotation to page asynchronously, refreshing rendering in all UI components.
| annotation | The Annotation to add. |
|---|---|
| selectImmediately | True when annotation should be selected for editing immediately after being added to the
page. This also enters annotation editing mode via enterAnnotationEditingMode(Annotation).
|
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.
| listener | DocumentActionListener that should be notified. Must be non-null. |
|---|
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.
| documentListener | Listener to be notified of document events. May not be null. |
|---|
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.
| documentScrollListener | Listener to be notified of document scroll events. May not be null. |
|---|
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.
| drawableProvider | PdfDrawableProvider whose drawable instances should be managed (e.g. rendered on screen). |
|---|
Offset PdfFragment insets by specified amount.
| leftOffset | The left inset offset in pixels. |
|---|---|
| topOffset | The top inset offset in pixels. |
| rightOffset | The right inset offset in pixels. |
| bottomOffset | The bottom inset offset in pixels. |
Register a AnnotationManager.OnAnnotationCreationModeChangeListener to get notified when annotation creation mode gets updated.
If the provider has been registered previously, this method will be a no-op.
| listener | Listener to register. Must be non-null. |
|---|
Register a AnnotationManager.OnAnnotationCreationModeSettingsChangeListener to get notified when annotation creation settings get updated.
If the provider has been registered previously, this method will be a no-op.
| listener | Listener to register. Must be non-null. |
|---|
Register a AnnotationManager.OnAnnotationDeselectedListener to get notified when annotation gets deselected.
If the provider has been registered previously, this method will be a no-op.
| listener | Listener to register. Must be non-null. |
|---|
Register a AnnotationManager.OnAnnotationEditingModeChangeListener to get notified when annotation editing mode gets updated.
If the provider has been registered previously, this method will be a no-op.
| listener | Listener to register. Must be non-null. |
|---|
Register a AnnotationManager.OnAnnotationSelectedListener to get notified when annotation gets selected.
If the provider has been registered previously, this method will be a no-op.
| listener | Listener to register. Must be non-null. |
|---|
Register a AnnotationProvider.OnAnnotationUpdatedListener to get notified when annotation gets updated.
If the listener has been registered previously, this method will be a no-op.
Note: Listeners methods are dispatched on the main UI thread.
| listener | Listener to register. Must be non-null. |
|---|
Adds a FormManager.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.
| listener | OnFormElementClickedListener that should be notified. Must be non-null. |
|---|
Adds a FormManager.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.
| listener | OnFormElementDeselectedListener that should be notified. Must be non-null. |
|---|
Adds a FormManager.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.
| listener | OnFormElementEditingModeChangeListener that should be notified. Must be non-null. |
|---|
Adds a FormManager.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.
| listener | OnFormElementSelectedListener that should be notified. Must be non-null. |
|---|
Adds a FormManager.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.
| listener | OnFormElementUpdatedListener that should be notified. Must be non-null. |
|---|
Adds a FormManager.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.
| listener | OnFormElementViewUpdatedListener that should be notified. Must be non-null. |
|---|
Adds a TextSelectionManager.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.
| listener | Listener to register. Must be non-null. |
|---|
Adds a TextSelectionManager.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.
| listener | OnTextSelectionModeChangeListener. Must be non-null. |
|---|
Notifies the navigation manager that calls to setPageIndex(int, boolean) should be added to
the navigation history until endNavigation() is called.
Clears all currently selected Annotations. This method may only be called on the main thread (UI
thread).
true if the the selection has been cleared.
Converts the coordinates stored within point from the PDF coordinate space of the given pageIndex
to the view coordinate space (i.e. screen pixels). This method modifies point in place.
This method throws an exception if called before the document has been laid out, or if a conversion for the given
pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded(PdfDocument) which is called after the document has been loaded, and the
document view has been laid out.
| point | PDF coordinates on the given pageIndex that should be converted to coordinates
of the document view (pixels). |
|---|---|
| pageIndex | Target page for the conversion (0 denotes the first page). |
| includeViewScroll | If true include document view scroll and page position into the calculations.
|
Converts the coordinates stored within point from the PDF coordinate space of the given pageIndex
to the view coordinate space (i.e. screen pixels). This method modifies point in place.
This method throws an exception if called before the document has been laid out, or if a conversion for the given
pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded(PdfDocument) which is called after the document has been loaded, and the
document view has been laid out.
| point | PDF coordinates on the given pageIndex that should be converted to coordinates of the
document view (pixels). |
|---|---|
| pageIndex | Target page for the conversion (0 denotes the first page).
|
Converts the PDF coordinates stored in rect (of the given pageIndex) to view coordinates. This
method modifies rect in place.
This method throws an exception if called before the document has been laid out, or if a conversion for the given
pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded(PdfDocument) which is called after the document has been loaded, and the
document view has been laid out.
| rect | PDF coordinates. |
|---|---|
| pageIndex | Target page of the coordinates (0 denotes the first page).
|
Converts the coordinates stored within point from the view coordinate space (i.e. screen pixels) to PDF
coordinate space of the given pageIndex. This method modifies point in place.
This method throws an exception if called before the document has been laid out, or if a conversion for the given
pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded(PdfDocument) which is called after the document has been loaded, and the
document view has been laid out.
| point | Point containing view coordinates (pixels) that should be converted to PDF coordinates. |
|---|---|
| pageIndex | Target page for the conversion (0 denotes the first page).
|
Converts the view coordinates stored in rect to PDF coordinates on the given pageIndex. This
method modifies rect in place.
This method throws an exception if called before the document has been laid out, or if a conversion for the given
pageIndex is not possible (e.g. requested page number is invalid). See onDocumentLoaded(PdfDocument) which is called after the document has been loaded, and the
document view has been laid out.
| rect | View coordinates. |
|---|---|
| pageIndex | Target page for the conversion (0 denotes the first page).
|
Commits the page changes to the navigation history dropping everything but the very last one.
Starts the annotation creation mode with the last used annotation tool as the selected one.
Additionally, annotation creator dialog will show up if the default annotation creator has not been set.
Enter annotation creation mode on the document. Once you invoke this method, you'll get AnnotationCreationController (through registered OnAnnotationCreationModeChangeListener) which provides
methods for annotation creation with a specified type.
Additionally, annotation creator dialog will show up if the default annotation creator has not been set.
| annotationTool | Annotation tool to activate once creation mode is entered. Use NONE
to just enter creation mode without any annotation creation tool selected.
|
|---|
Enter annotation editing mode on the document. Once you invoke this method, you'll get AnnotationEditingController (through registered OnAnnotationEditingModeChangeListener) which provides
methods for editing a selected annotation. Notice: this method will not select annotation on the screen, for that
use setSelectedAnnotation(Annotation).
| annotation | Annotation to be edited. |
|---|
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.
| pageIndex | Number of the page on which text selection should be performed. Has to be 0 <= pageIndex < totalPages. |
|---|---|
| textRange | 0-based range spanning the text which should be selected. Range has to be in the interval [0, textLength]. |
| IllegalArgumentException | If pageIndex is not in the page range.
|
|---|
Executes the given PDF action on the currently loaded document.
| action | Action to be executed. |
|---|---|
| actionSender | Optional sender that triggered execution of this action. |
Executes the given PDF action on the currently loaded document.
| action | Action that should be executed.
|
|---|
Exit any currently active mode on the document (annotation creation, annotation editing, text selection).
Returns manager for annotation defaults.
Returns manager for annotation preferences.
Gets the background color of the fragment. It's the background of the area behind the pages.
Returns configuration for this PdfFragment.
Get the loaded document.
Returns the loaded image document, or null if this fragment does not hold an image document.
ImageDocument instance or null if no image document is loaded.Returns the navigation history owned by this manager.
NavigationBackStack containing the entire navigation history.
Gets annotation types that should be rendered as overlays.
Gets annotations that should be rendered as overlays.
Gets number of pages in the document.
-1 if document is null.
Get currently displayed document page.
-1 if document is null.
Returns a transformation matrix for converting page coordinates (for the given pageIndex) to view
coordinates (relative to the fragment itself). The returned matrix can be inverted using invert(Matrix) to create a view-to-page conversion matrix.
| pageIndex | Number of the page for which to retrieve the transformation (starting at code). |
|---|---|
| reuse | A matrix object to reuse for calculation. May be null if a new matrix should be
created. |
| includeViewScroll | If true include document view scroll and page position into the calculations. |
null, if there is no transformation for the given page (e.g. the document is not yet loaded, or the
specified page doesn't exist).
Returns a transformation matrix for converting page coordinates (for the given pageIndex) to view
coordinates (relative to the fragment itself). The returned matrix can be inverted using invert(Matrix) to create a view-to-page conversion matrix.
| pageIndex | Number of the page for which to retrieve the transformation (starting at code). |
|---|---|
| reuse | A matrix object to reuse for calculation. May be null if a new matrix should be
created. |
null, if there is no transformation for the given page (e.g. the document is not yet loaded, or the
specified page doesn't exist).
Returns currently set password view for the fragment.
Returns a list of currently selected annotations, or an empty list if no annotations were selected.
Returns currently selected form element.
null if no element is selected.
Get page sibling index (usable in double page mode).
| pageIndex | Index of the page for which we look for the sibling. |
|---|
-1 if there is none.
Gets the currently set signature metadata.
Gets the currently used signature storage that will be used to store signatures when they're added to the document.
Get current state of the fragment.
null if views are not ready yet.
Returns the current text selection.
null if no text is selected.
Returns this fragment's undo manager instance for performing undo/redo operations of edits.
UndoManager used for handling undo/redo operations on this fragment.
Fetch the list of pages currently visible on the screen.
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.
| targetRect | RectF instance which will be set to the visible PDF rect. |
|---|---|
| pageIndex | Target page number. 0-based index. |
true if the page visible and its visible rect was written to targetRect, or
false if the page is not
visible and targetRect was not modified.
Get zoom scale at the specified page.
| pageIndex | Target page number. |
|---|
Indicates whether interaction with the document is enabled right now.
true when the user can interact with the document, false otherwise.
Indicates whether the displayed document is an image or not.
true if the displayed document is image, false otherwise.
Returns true if any of the special modes is active.
true when fragment is in a special mode - i.e. it has text, annotation or form selection is
active or when annotation creation is in progress.
Returns redaction annotation preview mode, false by default.
true if redaction annotation preview mode is enabled, false otherwise.
Indicates whether the scrolling is enabled, or not.
true if scrolling is enabled, false otherwise.
Indicates whether UI is enabled right now. UI is disabled when document is being saved/loaded, or when manually disabled.
true when UI is enabled right now.
Indicates whether the zooming is enabled, or not.
true if zooming is enabled, false otherwise.
Creates and returns a new Fragment to display a converted PDF document from a supported image format.
| documentUri | pointing to the image document to open. |
|---|---|
| configuration | Configuration for the image document to display generated with PdfConfiguration.Builder, or getDefaultImageDocumentConfiguration(). |
Creates and returns a new Fragment to display a converted PDF document from a supported image format.
| source | Document source to load the image from |
|---|---|
| configuration | Configuration for the image document to display generated with PdfConfiguration.Builder, or getDefaultImageDocumentConfiguration(). |
Creates and returns a new Fragment to display a converted PDF document from a supported image format.
| source | Instance of DataProvider to load the image from. Note: this object WILL NOT BE
RETAINED ON RECREATION unless it implements Parcelable interface. |
|---|---|
| configuration | Configuration for the image document to display generated with PdfConfiguration.Builder, or getDefaultImageDocumentConfiguration(). |
Creates and returns a new Fragment to display a PDF document from an PdfFragment. This will copy the
state of the given Fragment while applying the new configuration.
| fragment | An already displayed PdfFragment to copy the state from. |
|---|---|
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display passed list of PDF documents as a single compound document.
| documentUris | pointing to the document to open. |
|---|---|
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display passed list of PDF documents as a single compound document.
| documentUris | pointing to the document to open. |
|---|---|
| documentPasswords | A list of corresponding passwords for the given documents. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document from a custom data source
| source | Instance of DataProvider to load data from. Note: this object WILL NOT BE
RETAINED ON RECREATION unless it implements Parcelable interface. |
|---|---|
| password | Document password, can be null. |
| contentSignature | Content signature, can be null. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display passed list of PDF documents as a single compound document.
| documentUris | pointing to the document to open. |
|---|---|
| documentPasswords | A list of corresponding passwords for the given documents. |
| documentContentSignatures | A list of corresponding document content signatures for the given documents. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document from a custom data source.
| source | Instance of DataProvider to load data from. Note: this object WILL NOT BE RETAINED
ON RECREATION unless it implements Parcelable interface. |
|---|---|
| password | Document password, can be null. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document from an already opened PdfDocument instance.
This will not reload the document.
| document | An already opened instance of a PdfDocument object. |
|---|---|
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document.
| documentUri | pointing to the document to open |
|---|---|
| password | Document password, can be null. |
| contentSignature | Content signature, can be null. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document.
| documentUri | pointing to the document to open. |
|---|---|
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document.
| documentUri | pointing to the document to open. |
|---|---|
| password | Document password, can be null. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document from the given DocumentSources.
| sources | List of DocumentSources to load data from. |
|---|---|
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document from a custom data source as a compound document.
| sources | List of DataProviders to load data from. Note: this object WILL NOT BE RETAINED ON
RECREATION unless it implements Parcelable interface. |
|---|---|
| passwords | Document password, can be null. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document from a custom data source as a compound document.
| sources | List of DataProviders to load data from. Note: this object WILL NOT BE RETAINED ON
RECREATION unless it implements Parcelable interface. |
|---|---|
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
Creates and returns a new Fragment to display a PDF document from a custom data source as a compound document.
| sources | List of DataProviders to load data from. Note: this object WILL NOT BE RETAINED
ON RECREATION unless it implements Parcelable interface. |
|---|---|
| passwords | Document password, can be null. |
| contentSignatures | Content signature, can be null. |
| configuration | Configuration for PDF display generated with PdfConfiguration.Builder. |
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.
| annotation | Annotation that has changed. |
|---|
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.
Called when annotation gets deselected.
| annotation | Annotation that is being deselected. |
|---|---|
| reselected | true if annotation is being reselected (another annotation will be selected soon).
|
Called when annotation gets selected.
| annotation | Annotation that is being selected. |
|---|---|
| annotationCreated | true if selected annotation is being created in PageModeHandler.
|
Called when the user taps / clicks on the document, not the page itself but on the side (if visible).
true if tap is handled or false if PSPDFKit should execute it's default action.
Called if document loading has failed.
| exception | Cause of the loading failure. |
|---|
Called when document is successfully loaded and the document view has been laid out.
| document | Loaded document instance. |
|---|
Called before document will be saved. This callback allows cancellation of the save process.
| document | Instance of document to be saved. |
|---|---|
| saveOptions | Save options to be applied to the document. You may change parameters on this object to control how document is saved. |
true if the document should be saved, false if saving should be cancelled.
Called if document saving has been cancelled.
| document | Instance of document that was saved. |
|---|
Called if document saving has failed.
| exception | Cause of the saving failure if applicable. |
|---|
Called after the document has been saved.
| document | Instance of document that was saved. |
|---|
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.
| fragment | The scrolled PdfFragment. |
|---|---|
| currX | Current scroll amount X. |
| currY | Current scroll amount Y. |
| maxX | Maximum scroll amount of the X dimension. |
| maxY | Maximum scroll amount of the Y dimension. |
| extendX | Extend of the visible content in the X dimension. |
| extendY | Extend of the visible content in the Y dimension. |
Called when a user zooms a document.
| document | Current document. |
|---|---|
| pageIndex | The number of the page that the was zoomed. |
| scaleFactor | The current scale factor. |
Called when form element gets deselected.
| formElement | Form element that is being deselected. |
|---|---|
| reselected | true if form element is being reselected (another form element will be selected soon).
|
Called when form element gets selected.
| formElement | Form element that is being selected. |
|---|
Called when user scrolled to a new page.
| document | Currently opened document. |
|---|---|
| pageIndex | Page number of new page. |
Called when user taps / clicks on the page.
| document | Currently opened document. |
|---|---|
| pageIndex | Page number of the page being tapped. |
| event | MotionEvent that triggered this page click. May be null if this page
click was triggered from keyboard or accessibility event. |
| pagePosition | Tapped page position (in PDF page coordinates with origin on bottom left). Coordinates
passed here may exceed the page size (which is returned by getPageSize(int)) and can also be negative. If the click was triggered by
the keyboard, pagePosition will be null. |
| clickedAnnotation | Annotation that was tapped, or null if no annotation was tapped. |
true if tap was handled by this DocumentListener and should not be handled by PSPDFKit
anymore. If returning false PSPDFKit will continue executing it's default action.
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.
| pageIndex | Page index of the updated page. Page index is 0-based. |
|---|
Called immediately before annotation is going to be selected.
| controller | Selection controller that is performing the selection. |
|---|---|
| annotation | Annotation that is going to be selected. |
| annotationCreated | True when annotation is |
AnnotationSelectionController to proceed with selection. Returning false will prevent annotation from being
selected.
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.
Called whenever the current scroll state of the PdfFragment changed.
| fragment | PdfFragment whose scroll state changed. |
|---|---|
| state | The new scroll state. |
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.
| listener | DocumentActionListener that should be removed. Must be non-null. |
|---|
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.
| documentListener | Listener to unregister from document events. May not be null. |
|---|
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.
| documentScrollListener | Listener to unregister from document scroll events. May not be null. |
|---|
Removes a previously added PdfDrawableProvider.
If the provider hasn't been added previously, this method will be a no-op.
| drawableProvider | PdfDrawableProvider that should be removed. Must be non-null. |
|---|
Remove a previously registered AnnotationManager.OnAnnotationCreationModeChangeListener. If the provider hasn't been
registered previously, this method will be a no-op.
| listener | Listener to unregister. Must be non-null. |
|---|
Remove a previously registered AnnotationManager.OnAnnotationCreationModeSettingsChangeListener. If the provider hasn't been
registered previously, this method will be a no-op.
| listener | Listener to unregister. Must be non-null. |
|---|
Remove a previously registered AnnotationManager.OnAnnotationDeselectedListener. If the provider hasn't been
registered previously, this method will be a no-op.
| listener | Listener to unregister. Must be non-null. |
|---|
Remove a previously registered AnnotationManager.OnAnnotationEditingModeChangeListener. If the provider hasn't been
registered previously, this method will be a no-op.
| listener | Listener to unregister. Must be non-null. |
|---|
Remove a previously registered AnnotationManager.OnAnnotationSelectedListener. If the provider hasn't been
registered previously, this method will be a no-op.
| listener | Listener to unregister. Must be non-null. |
|---|
Remove a previously registered AnnotationProvider.OnAnnotationUpdatedListener. If the listener hasn't been
registered previously, this method will be a no-op.
| listener | Listener to unregister. Must be non-null. |
|---|
Removes a previously registered FormManager.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.
| listener | OnFormElementClickedListener that should be removed. Must be non-null. |
|---|
Removes a previously registered FormManager.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.
| listener | OnFormElementDeselectedListener that should be removed. Must be non-null. |
|---|
Removes a previously registered FormManager.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.
| listener | OnFormElementEditingModeChangeListener that should be removed. Must be non-null. |
|---|
Removes a previously registered FormManager.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.
| listener | OnFormElementSelectedListener that should be removed. Must be non-null. |
|---|
Removes a previously registered FormManager.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.
| listener | OnFormElementUpdatedListener that should be removed. Must be non-null. |
|---|
Removes a previously registered FormManager.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.
| listener | OnFormElementViewUpdatedListener that should be removed. Must be non-null. |
|---|
Removes a TextSelectionManager.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.
| listener | Listener to unregister. Must be non-null. |
|---|
Removes a previously added TextSelectionManager.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.
| listener | Listener to unregister. Must be non-null. |
|---|
Saves the file held by the document view back to it's original location. The save operation will be successful
only if all document listeners return true in onDocumentSave(PdfDocument, DocumentSaveOptions) and the document was actually modified.
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.
| pdfRect | Target area. |
|---|---|
| pageIndex | Page which should be scrolled to. |
| duration | Scroll animation duration (in milliseconds). |
| scrollWhenVisible | Whether scrolling should be performed if the target area is already completely visible, or not. |
Configures annotation defaults provider for given annotation type. This replaces default provider.
| annotationType | Type of annotation for which to set defaults provider. |
|---|---|
| defaultsProvider | Defaults provider to set. |
Sets the background color of the fragment. It's the background of the area behind the pages.
| backgroundColor | Color to be set. |
|---|
Sets the custom source for the PDF file.
| source | PDF document source. |
|---|
Sets the custom sources for the PDF file.
| sources | List of PDF document sources. |
|---|
Enables or disables interaction with the document. 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.
| isDocumentInteractionEnabled | true to enable interacting with the document, false to
disable it.
|
|---|
Sets a new DocumentSigningListener or replaces an existing one. This allows capturing of digital signing
events.
If not set or set to null, a default implementation of DocumentSigningListener is used.
| documentSigningListener | new document signing listener. |
|---|
Set insets that will be used as padding for PdfFragment contents.
| left | The left inset in pixels. |
|---|---|
| top | The top inset in pixels. |
| right | The right inset in pixels. |
| bottom | The bottom inset in pixels. |
Set 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.
| listener | OnDocumentLongPressListener that should be notified, or null to clear the
listener.
|
|---|
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.
| listener | Listener to register. |
|---|
Sets annotation types that should be rendered as overlays.
If annotation is not rendered as overlay, it is rendered within the page image. Rendering as overlay performs better if you frequently change annotations, but might delay page display and increase memory usage.
Following annotation types support overlay mode:
NOTE are always rendered as overlays.
| overlayAnnotationTypes | Annotation types that should be rendered as overlays. |
|---|
Sets annotations that should be rendered as overlays. This enables overlay rendering for annotations even when
their types are not enabled for overlay rendering via setOverlaidAnnotationTypes(EnumSet).
If annotation is not rendered as overlay, it is rendered within the page image. Rendering as overlay is more performant if you frequently change annotations, but might delay page display and increase memory usage.
| overlayAnnotations | List of annotations that should be rendered as overlays. |
|---|
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(int, boolean).
This method will throw an exception if pageIndex < 0 || pageIndex >= pageCount (as returned by getPageCount()).
| pageIndex | Target page which should be displayed. |
|---|
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.
This method will throw an exception if pageIndex < 0 || pageIndex >= pageCount (as returned by getPageCount()).
| pageIndex | Target page which should be displayed. |
|---|---|
| animated | Set to true, if a transitioning animation should be performed. Otherwise to false.
|
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.
| drawable | Drawable to display while document loads and pages are being rendered, null to hide the
loading drawable.
|
|---|
Sets password view to be used for the password-protected documents.
| pdfPasswordView | The password view to use. |
|---|
Sets redaction annotations preview as redacted.
| enable | true to show redaction annotations as redacted, false to show them as marks.
|
|---|
Enables/disabled the scrolling performed by the user. Enabled by default.
| enabled | true to enable scrolling, false to disable it.
|
|---|
Selects a single Annotation. This will also start annotation editing mode with selected annotation being
edited.
| annotation | The Annotation to select
|
|---|
Sets the currently selected Annotations. Selecting multiple annotations will not start the annotation
editing mode, where selecting a single one will.
| annotations | The Annotations to select.
|
|---|
Sets the currently selected FormElement.
| formElement | The FormElement to select.
|
|---|
Sets the signature metadata that will be used when digitally signing the document.
| signatureMetadata | The signature metadata that will be used when digitally signing the document, or null to not add additional metadata.
|
|---|
Sets the signature storage that will be used to store signatures when they're added to the document (if saving signatures is enabled).
| signatureStorage | Signature storage to use when saving signatures, or null to use the default one.
|
|---|
Enables or disables the user interface. When the user interface is disabled all temporary UI elements (navigation buttons, readaction UI) are hidden, and all user interaction is disabled (no scrolling, no clicking on the thumbnail bar, no annotation editing).
| isUserInterfaceEnabled | true to enable the UI, false to disable the UI.
|
|---|
Enables/disabled the zooming performed by the user. Enabled by default.
| enabled | true to enable zooming, false to disable it.
|
|---|
Zoom by the given scale focused on the given point in PDF coordinates.`
| focusX | x-coordinate of the focus point. |
|---|---|
| focusY | y-coordinate of the focus point. |
| pageIndex | Page number. |
| scaleFactor | Scale factor for zooming. |
| duration | Duration of the zoom animation (milliseconds). |
Zoom to the given scale focused on the given point in PDF coordinates.
| focusX | x-coordinate of the focus point. |
|---|---|
| focusY | y-coordinate of the focus point. |
| pageIndex | Page number. |
| targetScale | Final scale to zoom page to. |
| duration | Duration of the zoom animation (milliseconds). |
Zoom to a specific rect on the given page.
| rect | Rect to zoom into. |
|---|---|
| pageIndex | Page number of the target page. |
| duration | Duration of the zoom animation in milliseconds. |