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 |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
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 | addOnContentEditingContentChangeListener(ContentEditingManager.OnContentEditingContentChangeListener listener) | ||||||||||
void | addOnContentEditingModeChangeListener(ContentEditingManager.OnContentEditingModeChangeListener listener) | ||||||||||
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 |
addOverlayViewProvider(OverlayViewProvider overlayViewProvider)
Adds an
OverlayViewProvider for adding overlay views to this fragment. | ||||||||||
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
Annotation s. | ||||||||||
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, AnnotationToolVariant annotationToolVariant)
Enter annotation creation mode on the document.
| ||||||||||
void |
enterAnnotationCreationMode(AnnotationTool annotationTool)
Enter annotation creation mode on the document.
| ||||||||||
void |
enterAnnotationEditingMode(Annotation annotation)
Enter annotation editing mode on the document.
| ||||||||||
void |
enterContentEditingMode()
Starts the content editing mode which allows for modifying PDF content text
| ||||||||||
void | enterFormEditingMode(FormElement formElement) | ||||||||||
void |
enterTextSelectionMode(int pageIndex, Range textRange)
Sets the current text selection.
| ||||||||||
void |
enterTextSelectionMode(int pageIndex, TextSelectionRectangles touchedTextRects)
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).
| ||||||||||
AnnotationTool |
getActiveAnnotationTool()
Returns the active annotation tool.
| ||||||||||
AnnotationToolVariant |
getActiveAnnotationToolVariant()
Returns the variant of the active annotation tool variant (if any).
| ||||||||||
AnnotationConfigurationRegistry |
getAnnotationConfiguration()
Returns annotation configuration registry with annotation configuration for supported
annotation types and/or tools.
| ||||||||||
AnnotationPreferencesManager |
getAnnotationPreferences()
Returns manager for annotation preferences.
| ||||||||||
AudioModeManager |
getAudioModeManager()
Returns this fragment's audio mode manager instance for entering/leaving audio playback or
recording modes.
| ||||||||||
int |
getBackgroundColor()
Gets the background color of the fragment.
| ||||||||||
PdfConfiguration |
getConfiguration()
Returns configuration for this PdfFragment.
| ||||||||||
ContentEditingFillColorConfiguration |
getContentEditingConfiguration()
Returns content editing fill color configuration
Note: This method must be called after views are created (after | ||||||||||
ContentEditingPreferencesManager |
getContentEditingPreferences()
Returns manager for content editing preferences.
| ||||||||||
ContentEditingState |
getContentEditingState()
Returns the current content editing state.
| ||||||||||
UndoManager |
getContentEditingUndoManager()
Returns this fragment's undo manager instance for performing undo/redo operations of content edits.
| ||||||||||
PdfDocument |
getDocument()
Gets 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()
Gets currently displayed document page.
| ||||||||||
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)
Gets 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()
Gets 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 annotation edits.
| ||||||||||
ViewProjection |
getViewProjection()
Returns the
ViewProjection for transforming between the view coordinates and PDF
coordinates. | ||||||||||
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)
Gets 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 | onViewCreated(View view, Bundle savedInstanceState) | ||||||||||
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 | removeOnContentEditingContentChangeListener(ContentEditingManager.OnContentEditingContentChangeListener listener) | ||||||||||
void | removeOnContentEditingModeChangeListener(ContentEditingManager.OnContentEditingModeChangeListener listener) | ||||||||||
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 |
removeOverlayViewProvider(OverlayViewProvider overlayViewProvider)
Removes a previously added
OverlayViewProvider . | ||||||||||
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 |
setAnnotationOverlayRenderStrategy(AnnotationOverlayRenderStrategy overlayRenderStrategy)
Sets the annotation overlay render strategy.
| ||||||||||
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)
Sets insets that will be used as padding for
PdfFragment contents. | ||||||||||
void |
setOnDocumentLongPressListener(OnDocumentLongPressListener listener)
Sets 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
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. | ||||||||||
void |
setPageIndex(int pageIndex, boolean animated)
Sets the
pageIndex to be displayed (0 is the first one). | ||||||||||
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
Annotation s. | ||||||||||
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. |
---|
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.
The OverlayViewProvider
is linked with the lifecycle of the PdfFragment
it
is attached to, meaning that when used inside a PdfActivity
you need to make sure to
reattach it when the fragment changes, for example when the document changes.
Using this API requires the current license to contain the annotations component.
This API is still experimental. While it is tested, and doesn't contain any known bugs, it might be changed or removed with any minor release.
overlayViewProvider | OverlayViewProvider whose view instances should be added to the document view. |
---|
InvalidPSPDFKitLicenseException | If the current license doesn't contain the annotations component. |
---|
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 Annotation
s. This method may only be called on the main
thread (UI thread).
true
if the the selection has been cleared.
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 an annotation creation tool
selected. |
---|---|
annotationToolVariant | Specifies the variant of the annotation tool in which to start this mode. |
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. Uses default AnnotationToolVariant
.
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. |
---|
Starts the content editing mode which allows for modifying PDF content text
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.
|
---|
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. |
---|---|
touchedTextRects | List of rectangles (in PDF coordinates) under which text selection is to be performed |
IllegalArgumentException | If pageIndex is not in the page range, or if text rectangles on page don't
contain any of @{code touchedTextRects}.
|
---|
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 the active annotation tool.
Returns the variant of the active annotation tool variant (if any).
Returns annotation configuration registry with annotation configuration for supported annotation types and/or tools.
Note: This method must be called after views are created (after onCreateView(LayoutInflater, ViewGroup, Bundle)
).
AnnotationConfiguration
for this fragment.
Returns manager for annotation preferences.
Note: This method must be called after views are created (after onCreateView(LayoutInflater, ViewGroup, Bundle)
).
Returns this fragment's audio mode manager instance for entering/leaving audio playback or recording modes.
AudioModeManager
used for handling audio modes on this fragment.
Gets the background color of the fragment. It's the background of the area behind the pages.
Returns configuration for this PdfFragment.
Returns content editing fill color configuration
Note: This method must be called after views are created (after onCreateView(LayoutInflater, ViewGroup, Bundle)
).
ContentEditingFillColorConfiguration
for this fragment.
Returns manager for content editing preferences.
Note: This method must be called after views are created (after onCreateView(LayoutInflater, ViewGroup, Bundle)
).
Returns the current content editing state.
null
if content editing is not active.
Returns this fragment's undo manager instance for performing undo/redo operations of content edits.
UndoManager
used for handling undo/redo operations on this fragment.
Gets 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
.
Gets currently displayed document page.
-1
if document is null
.
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.
Gets 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.
If Electronic Signatures are enabled in your license, this property defaults to null,
which means signatures can't be saved. To enable simple on-device signature storage, set this
to an instance of SignatureStorage
.
If Annotations were enabled in your license before the introduction of the Electronic
Signatures component, this defaults to our DatabaseSignatureStorage
implementation.
To remove the UI option to choose whether or not to save signatures and force them to be
saved, change the `signatureSavingStrategy` in your PdfConfiguration
or the used
SignatureOptions
.
Gets 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 annotation edits.
UndoManager
used for handling undo/redo operations on this fragment.
Returns the ViewProjection
for transforming between the view coordinates and PDF
coordinates.
ViewProjection
for transforming between the view coordinates and PDF
coordinates.
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.
Gets 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 DocumentSource s 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 DataProvider s 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 DataProvider s 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 DataProvider s 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. This has to be called on the main thread.
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 if the annotation is being created. |
true
when you want AnnotationSelectionController
to proceed with
the 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. |
---|
Removes a previously added OverlayViewProvider
. If the provider hasn't been added
previously, this method will be a no-op.
Using this API requires the current license to contain the annotations component.
This API is still experimental. While it is tested, and doesn't contain any known bugs, it might be changed or removed with any minor release.
overlayViewProvider | OverlayViewProvider that should be removed. Must be non-null. |
---|
InvalidPSPDFKitLicenseException | If the current license doesn't contain the annotations component. |
---|
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. |
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, PSPDFKit uses 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
.
Note: Render strategy is used whenever annotation is extracted to overlay - i.e. after changing set of overlaid annotations (or types), creating new annotations or when loading page after opening the document or scrolling to a new page that is not yet cached (PSPDFKit instantiates around 5 pages around the currently visible pages to achieve smooth scrolling). Note that strategy changes are not applied until above events occur.
overlayRenderStrategy | Overlay annotations render strategy, null to use the
default strategy.
|
---|
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. |
---|
Sets 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. |
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.
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 Annotation
s. Selecting multiple annotations will not
start the annotation editing mode, where selecting a single one will.
annotations | The Annotation s 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. |