com.pspdfkit.annotations.AnnotationProvider |
![]() |
Handles all annotation related operations on the owning document. Retrieve it with getAnnotationProvider()
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | AnnotationProvider.OnAnnotationUpdatedListener | Listener for annotation update events inside AnnotationProvider . |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final EnumSet<AnnotationType> | ALL_ANNOTATION_TYPES | All annotation types that can displayed in the annotation list. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract void |
addAnnotationToPage(Annotation annotation)
Adds annotation to the owner PDF document.
| ||||||||||
abstract void |
addAnnotationToPage(Annotation annotation, int zIndex)
Adds annotation to the owner PDF document at the specified z-index.
| ||||||||||
abstract Completable |
addAnnotationToPageAsync(Annotation annotation, int zIndex)
Adds annotation to the owner PDF document asynchronously, at the specified z-index.
| ||||||||||
abstract Completable |
addAnnotationToPageAsync(Annotation annotation)
Adds annotation to the owner PDF document asynchronously.
| ||||||||||
abstract void |
addAppearanceStreamGenerator(AppearanceStreamGenerator appearanceStreamGenerator)
Adds appearance stream generator to the list of global appearance stream generators.
| ||||||||||
abstract void |
addAppearanceStreamGenerator(AppearanceStreamGenerator appearanceStreamGenerator, boolean addFirst)
Adds appearance stream generator to the list of global appearance stream generators.
| ||||||||||
abstract void |
addOnAnnotationUpdatedListener(AnnotationProvider.OnAnnotationUpdatedListener updatedListener)
Adds an
AnnotationProvider.OnAnnotationUpdatedListener for being notified of updates to annotations. | ||||||||||
abstract void |
appendAnnotationState(Annotation annotation, AnnotationStateChange annotationStateChange)
Appends a new annotation state for the given annotation (adds it to the review history).
| ||||||||||
abstract Completable |
appendAnnotationStateAsync(Annotation annotation, AnnotationStateChange annotationStateChange)
Appends a new annotation state for the given annotation asynchronously (adds it to the review
history).
| ||||||||||
abstract Annotation |
createAnnotationFromInstantJson(String annotationJson)
Creates an annotation from the Instant JSON annotation format.
| ||||||||||
abstract Single<Annotation> |
createAnnotationFromInstantJsonAsync(String annotationJson)
Creates an annotation from the Instant JSON annotation format asynchronously.
| ||||||||||
abstract List<Annotation> |
getAllAnnotationsOfType(EnumSet<AnnotationType> types, int startIndex, int pageCount)
Returns all annotations of passed types in the specified page index range.
| ||||||||||
abstract List<Annotation> |
getAllAnnotationsOfType(EnumSet<AnnotationType> types)
Returns all annotations of passed types in this document.
| ||||||||||
abstract Observable<Annotation> |
getAllAnnotationsOfTypeAsync(EnumSet<AnnotationType> types, int startIndex, int pageCount)
Returns all annotations of passed types in the specified page index range.
| ||||||||||
abstract Observable<Annotation> |
getAllAnnotationsOfTypeAsync(EnumSet<AnnotationType> types)
Returns all annotations of passed types in this document.
| ||||||||||
abstract Annotation |
getAnnotation(int pageIndex, int objectNumber)
Returns annotation with certain object ID on the page if it exists.
| ||||||||||
abstract Maybe<Annotation> |
getAnnotationAsync(int pageIndex, int objectNumber)
Returns annotation with certain object ID on the page if it exists, asynchronously.
| ||||||||||
abstract List<Annotation> |
getAnnotationReplies(Annotation annotation)
Gets all first-level replies to a particular annotation.
| ||||||||||
abstract Single<List<Annotation>> |
getAnnotationRepliesAsync(Annotation annotation)
Gets all first-level replies to a particular annotation asynchronously.
| ||||||||||
abstract List<Annotation> |
getAnnotations(Collection<Integer> objectNumbers)
Returns annotations with given object numbers.
| ||||||||||
abstract List<Annotation> |
getAnnotations(int pageIndex)
Returns a list of annotations on the page.
| ||||||||||
abstract Observable<List<Annotation>> |
getAnnotationsAsync(int pageIndex)
Returns list of annotations on the page.
| ||||||||||
abstract Observable<List<Annotation>> |
getAnnotationsAsync(Collection<Integer> objectNumbers)
Returns annotations with given object numbers, asynchronously.
| ||||||||||
abstract List<Annotation> |
getFlattenedAnnotationReplies(Annotation annotation)
Gets all flattened replies (all replies included but no nesting) to a particular annotation.
| ||||||||||
abstract Single<List<Annotation>> |
getFlattenedAnnotationRepliesAsync(Annotation annotation)
Gets all flattened replies (all replies included but no nesting) to a particular annotation
asynchronously.
| ||||||||||
abstract List<AnnotationStateChange> |
getReviewHistory(Annotation annotation)
Gets the review history of an annotation.
| ||||||||||
abstract Single<List<AnnotationStateChange>> |
getReviewHistoryAsync(Annotation annotation)
Gets the review history of an annotation asynchronously.
| ||||||||||
abstract AnnotationReviewSummary |
getReviewSummary(Annotation annotation, String currentUser)
Gets a summary information about the given annotation's review state.
| ||||||||||
abstract Maybe<AnnotationReviewSummary> |
getReviewSummaryAsync(Annotation annotation, String currentUser)
Gets a summary information about the given annotation's review state asynchronously.
| ||||||||||
abstract int |
getZIndex(Annotation annotation)
Gets the z-index of the provided annotation.
| ||||||||||
abstract Single<Integer> |
getZIndexAsync(Annotation annotation)
Gets the z-index of the provided annotation.
| ||||||||||
abstract boolean |
hasUnsavedChanges()
Returns whether there are unsaved changes to annotations in this document.
| ||||||||||
abstract void |
moveAnnotation(Annotation annotation, int zIndex)
Moves the annotation to the specified z-index.
| ||||||||||
abstract void |
moveAnnotation(int pageIndex, int fromZIndex, int toZIndex)
Moves the annotation to the specified z-index.
| ||||||||||
abstract void |
moveAnnotation(Annotation annotation, AnnotationZIndexMove zIndexMove)
Moves the annotation with the specified z-index move action.
| ||||||||||
abstract Completable |
moveAnnotationAsync(Annotation annotation, AnnotationZIndexMove zIndexMove)
Moves the annotation with the specified z-index move action asynchronously.
| ||||||||||
abstract Completable |
moveAnnotationAsync(Annotation annotation, int zIndex)
Moves the annotation to the specified z-index asynchronously.
| ||||||||||
abstract Completable |
moveAnnotationAsync(int pageIndex, int fromZIndex, int toZIndex)
Moves the annotation to the specified z-index asynchronously.
| ||||||||||
abstract void |
removeAnnotationFromPage(Annotation annotation)
Removes annotation from the document.
| ||||||||||
abstract Completable |
removeAnnotationFromPageAsync(Annotation annotation)
Removes annotation from this document asynchronously.
| ||||||||||
abstract void |
removeAppearanceStreamGenerator(AppearanceStreamGenerator appearanceStreamGenerator)
Remove appearance stream generator that was previously added in
addAppearanceStreamGenerator(AppearanceStreamGenerator) . | ||||||||||
abstract void |
removeOnAnnotationUpdatedListener(AnnotationProvider.OnAnnotationUpdatedListener updatedListener)
Removes a previously added
AnnotationProvider.OnAnnotationUpdatedListener . |
All annotation types that can displayed in the annotation list.
Adds annotation to the owner PDF document. The annotation will be attached to the page set in its constructor.
annotation | Annotation to be added to the document. |
---|
Adds annotation to the owner PDF document at the specified z-index. The annotation will be attached to the page set in its constructor.
annotation | Annotation to be added to the document. |
---|---|
zIndex | Z-index at which the annotation will be inserted. |
Adds annotation to the owner PDF document asynchronously, at the specified z-index. The annotation will be attached to the page set in its constructor.
annotation | Annotation to be added to the document. |
---|---|
zIndex | Z-index at which the annotation will be inserted. |
Adds annotation to the owner PDF document asynchronously. The annotation will be attached to the page set in its constructor.
annotation | Annotation to be added to the document. |
---|
Adds appearance stream generator to the list of global appearance stream generators.
Appearance stream generators in this list are queried for all annotations in the document
until one of them returns true
from shouldUseGeneratorForAnnotation(Annotation)
. This generator is
then used to generate custom appearance stream by calling getDataProviderForAnnotation(Annotation, EnumSet)
. If no such
generator is found in the list, annotation's generator (set via setAppearanceStreamGenerator(AppearanceStreamGenerator)
is used. Appearance
stream generation fallbacks to default rendering if annotation has no appearance stream
generator set.
Note: This does not automatically remove existing appearance streams. The
appearance stream only gets generated when the annotation has been modified or when calling
generateAppearanceStream()
explicitly.
appearanceStreamGenerator | Appearance stream generator. |
---|
Adds appearance stream generator to the list of global appearance stream generators.
Appearance stream generators in this list are queried in order until one of them returns
true
from shouldUseGeneratorForAnnotation(Annotation)
. This generator is
then used to generate custom appearance stream for the annotation by calling getDataProviderForAnnotation(Annotation, EnumSet)
. If no such
generator is found in the list, annotation's generator (set via setAppearanceStreamGenerator(AppearanceStreamGenerator)
is used. Appearance
stream generation fallbacks to default rendering if annotation has no appearance stream
generator set.
Note: This does not automatically remove existing appearance streams. The
appearance stream only gets generated when the annotation has been modified or when calling
generateAppearanceStream()
explicitly.
appearanceStreamGenerator | Appearance stream generator. |
---|---|
addFirst | Adds appearance stream generator to the beginning of the list. It will be used before any registered generator. |
Adds an AnnotationProvider.OnAnnotationUpdatedListener
for being notified of updates to annotations. If
the listener has already been added previously, this method will be a no-op. Passing null
is not allowed and will result in an exception.
updatedListener | AnnotationProvider.OnAnnotationUpdatedListener that should be notified. Must be
non-null . |
---|
Appends a new annotation state for the given annotation (adds it to the review history).
annotation | Annotation for which to set the state. |
---|---|
annotationStateChange | New annotation state to be set. |
Appends a new annotation state for the given annotation asynchronously (adds it to the review history).
annotation | Annotation for which to set the state. |
---|---|
annotationStateChange | New annotation state to be set. |
Completable
that completes once the annotation state has been appended.
Creates an annotation from the Instant JSON annotation format. The JSON must contain the
type, the page number and any other required properties for that type. The created annotation
will be automatically added to the document, and any registered AnnotationProvider.OnAnnotationUpdatedListener
will be notified of the creation.
annotationJson | Instant JSON representation of the annotation to be created. |
---|
Creates an annotation from the Instant JSON annotation format asynchronously. The JSON must
contain the type, the page number and any other required properties for that type. The
created annotation will be automatically added to the document, and any registered AnnotationProvider.OnAnnotationUpdatedListener
will be notified of the creation.
annotationJson | Instant JSON representation of the annotation to be created. |
---|
Returns all annotations of passed types in the specified page index range.
Note: this call may block for a while and should not be invoked on the main
thread. You can use getAllAnnotationsOfTypeAsync(EnumSet, int, int)
instead.
types | Annotation types to return. ALL_ANNOTATION_TYPES can be used as a
shorthand parameter for all annotations. |
---|---|
startIndex | Index of the page to start the search. |
pageCount | Number of pages to be included, starting the count with the startIndex page. |
Returns all annotations of passed types in this document.
Note: this call may block for a while and should not be invoked on the main
thread. You can use getAllAnnotationsOfTypeAsync(EnumSet)
instead.
types | Annotation types to return. ALL_ANNOTATION_TYPES can be used as a
shorthand parameter for all annotations. |
---|
Returns all annotations of passed types in the specified page index range.
WARNING: Parsing all annotations in a document can take some time. If you have to
use it as a synchronous call, use getAllAnnotationsOfType(EnumSet, int, int)
.
types | Annotation types to return. ALL_ANNOTATION_TYPES can be used as a
shorthand parameter for all annotations. |
---|---|
startIndex | Index of the page to start the search. |
pageCount | Number of pages to be included, starting the count with the startIndex page. |
Returns all annotations of passed types in this document.
WARNING: Parsing all annotations in a document can take some time. If you have to
use it as a synchronous call, use getAllAnnotationsOfType(EnumSet)
.
types | Annotation types to return. ALL_ANNOTATION_TYPES can be used as a
shorthand parameter for all annotations. |
---|
Returns annotation with certain object ID on the page if it exists.
Note: this call may block for a while and should not be invoked on the main thread.
pageIndex | Page index of the page where the annotation is. |
---|---|
objectNumber | Object number of the annotation to retrieve. |
null
if not found.
Returns annotation with certain object ID on the page if it exists, asynchronously.
pageIndex | Page index of the page where the annotation is. |
---|---|
objectNumber | Object number of the annotation to retrieve. |
Maybe
that either emits the requested annotation in
`onSuccess()` or terminates with `onCompleted()` or `onError()`.
Gets all first-level replies to a particular annotation. First-level replies are annotations
that return the given annotation via getInReplyTo()
. The sort order is
determined by the creation date.
annotation | Annotation whose replies we're fetching. |
---|
Gets all first-level replies to a particular annotation asynchronously. First-level replies
are annotations that return the given annotation via getInReplyTo()
. The
sort order is determined by the creation date.
annotation | Annotation whose replies we're fetching. |
---|
Single
that emits a list of first-level replies to the given annotation.
Returns annotations with given object numbers.
objectNumbers | Collection of object numbers to search for. |
---|
Returns a list of annotations on the page. For annotations not currently recognised and
handled by PSPDFKit this returns UnknownAnnotation
.
Note: this call may block for a while and should not be invoked on the main thread.
pageIndex | 0-indexed page number. |
---|
Returns list of annotations on the page. For annotations not currently recognised and handled
by PSPDFKit this returns UnknownAnnotation
.
pageIndex | 0-indexed page number. |
---|
Returns annotations with given object numbers, asynchronously.
objectNumbers | Collection of object numbers to search for. |
---|
Gets all flattened replies (all replies included but no nesting) to a particular annotation. The sort order is determined by the creation date.
annotation | Annotation whose replies we're fetching. |
---|
Gets all flattened replies (all replies included but no nesting) to a particular annotation asynchronously. The sort order is determined by the creation date.
annotation | Annotation whose replies we're fetching. |
---|
Single
that emits a list of all replies (flattened) to the given annotation.
Gets the review history of an annotation. The review history of an annotation is the list of states it has passed, for example, "Accepted", "Cancelled", and so on. This list is ordered chronologically, where the last element is the most current one according to the creation date of the annotation change.
annotation | Annotation for which to retrieve the review history. |
---|
Gets the review history of an annotation asynchronously. The review history of an annotation is the list of states it has passed, for example, "Accepted", "Cancelled", and so on. This list is ordered chronologically, where the last element is the most current one according to the creation date of the annotation change.
annotation | Annotation for which to retrieve the review history. |
---|
Gets a summary information about the given annotation's review state.
annotation | Annotation for which to get the review summary. |
---|---|
currentUser | The name of the current user, null to avoid including the current
user into the review summary. |
null
if it could not be retrieved.
Gets a summary information about the given annotation's review state asynchronously.
annotation | Annotation for which to get the review summary. |
---|---|
currentUser | The name of the current user, null to avoid including the current
user into the review summary. |
Maybe
returning the given annotation review summary, or none if it could not
be retrieved.
Gets the z-index of the provided annotation.
annotation | Annotation for which to retrieve the z-index. |
---|
Gets the z-index of the provided annotation.
annotation | Annotation for which to retrieve the z-index. |
---|
Single
object that will contain the z-index as the value.
Returns whether there are unsaved changes to annotations in this document.
true
if annotations were modified in this document and the document should be
saved.
Moves the annotation to the specified z-index.
annotation | Annotation to move. |
---|---|
zIndex | Target z-index to move the annotation to. |
Moves the annotation to the specified z-index.
pageIndex | Index of the page on which to reorder the annotations. |
---|---|
fromZIndex | The original z-index of the annotation that needs to be moved (from the specified page) |
toZIndex | Target z-index for the annotation to be moved to. |
Moves the annotation with the specified z-index move action.
annotation | Annotation to move. |
---|---|
zIndexMove | Z-index move action to be applied on the given annotation. |
Moves the annotation with the specified z-index move action asynchronously.
annotation | Annotation to move. |
---|---|
zIndexMove | Z-index move action to be applied on the given annotation. |
Completable
object completing after the move has been done.
Moves the annotation to the specified z-index asynchronously.
annotation | Annotation to move. |
---|---|
zIndex | Target z-index to move the annotation to. |
Completable
object completing after the move has been done.
Moves the annotation to the specified z-index asynchronously.
pageIndex | Index of the page on which to reorder the annotations. |
---|---|
fromZIndex | The original z-index of the annotation that needs to be moved (from the specified page) |
toZIndex | Target z-index for the annotation to be moved to. |
Completable
object completing after the move has been done.
Removes annotation from the document. If the annotation is not attached to the document of this annotation provider, this will be a no-op. Note that when using the Replies component of PSPDFKit (requires extra license flag), any replies to the removed annotation will be automatically removed as well from the document.
annotation | Annotation to be removed from the document. May not be null .
|
---|
Removes annotation from this document asynchronously.
annotation | Annotation to be removed from the document. |
---|
Remove appearance stream generator that was previously added in addAppearanceStreamGenerator(AppearanceStreamGenerator)
.
Removes a previously added AnnotationProvider.OnAnnotationUpdatedListener
. Upon calling this method the
listener
will no longer be notified of any changes. If the listener has not been
added previously, this method will be a no-op. Passing null
is not allowed, and will
result in an exception.
updatedListener | AnnotationProvider.OnAnnotationUpdatedListener that should be removed. Must be
non-null . |
---|