Interface IAnnotationManager
Namespace: PSPDFKit.Api.Annotation
Assembly: Api.dll
Syntax
public interface IAnnotationManager
Properties
| Edit this page View SourceAnnotationFactory
Gets an instance of annotation factory.
Declaration
IAnnotationFactory AnnotationFactory { get; }
Property Value
| Type | Description |
|---|---|
| IAnnotationFactory |
Methods
| Edit this page View SourceAddAnnotationAsync(IAnnotation)
Creates annotation on document.
Declaration
Task<string> AddAnnotationAsync(IAnnotation annotation)
Parameters
| Type | Name | Description |
|---|---|---|
| IAnnotation | annotation | Annotation to be added to document. |
Returns
| Type | Description |
|---|---|
| Task<string> | Annotation Id |
ApplyRedactionAsync()
Applies redactions to the current document. This will overwrite the opened file, removing content from the document irreversibly.
In the process of redacting the content, all the redaction annotations will be removed. Any annotation that is either partially or completely covered by a redaction annotation will be deleted.Declaration
Task ApplyRedactionAsync()
Returns
| Type | Description |
|---|---|
| Task | An asynchronous task representing operation of applying redaction. |
DeleteAnnotationsAsync(IEnumerable<IAnnotation>)
Deletes the sent annotations.
Declaration
Task DeleteAnnotationsAsync(IEnumerable<IAnnotation> annotations)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IAnnotation> | annotations | Annotations to be deleted. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents an asynchronous operation of deleting an annotations. |
DeleteAnnotationsAsync(IEnumerable<string>)
Deletes annotations with sent annotation ids.
Declaration
Task DeleteAnnotationsAsync(IEnumerable<string> annotationIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | annotationIds | Ids of annotations to be deleted. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents an asynchronous operation of deleting annotations using their id. |
DeselectAnnotationsAsync()
Deselects all annotations.
Declaration
Task DeselectAnnotationsAsync()
Returns
| Type | Description |
|---|---|
| Task | A task that represents an asynchronous operation of deselecting all annotations. |
ExportInstantJsonAsync()
Return a representation of the current document state in Instant Json.
Declaration
Task<string> ExportInstantJsonAsync()
Returns
| Type | Description |
|---|---|
| Task<string> | A task that represents an asynchronous operation of exporting annotations as string holding the Instant Json information. |
FlattenAnnotationAsync(IEnumerable<uint>)
Flattens annotations on selected pages.
Declaration
Task FlattenAnnotationAsync(IEnumerable<uint> pageIndices)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<uint> | pageIndices | Pages on which annotations should be flatted. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents an asynchronous operation of flattening annotations on selected pages. |
GetAnnotationsOnPageAsync(uint)
Gets annotations on specified page.
Declaration
Task<IImmutableList<IAnnotation>> GetAnnotationsOnPageAsync(uint pageIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | pageIndex | The page index for the annotations you want. It is zero-based and has a maximum value of totalPageCount - 1 |
Returns
| Type | Description |
|---|---|
| Task<IImmutableList<IAnnotation>> | An asynchronous task returning an immutable list of annotation on completion. |
ImportInstantJsonAsync(JObject)
Load a document state from Instant Json. Will throw if the json is malformed or the PDF ID does not match the document which is currently open.
Declaration
Task ImportInstantJsonAsync(JObject instantJson)
Parameters
| Type | Name | Description |
|---|---|---|
| JObject | instantJson | Instant json object. |
Returns
| Type | Description |
|---|---|
| Task |
SetSelectedAnnotationsAsync(IEnumerable<IAnnotation>)
Selects the sent annotations.
Declaration
Task SetSelectedAnnotationsAsync(IEnumerable<IAnnotation> annotations)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IAnnotation> | annotations | Annotations to be selected. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents an asynchronous operation of selecting an annotations. |
SetSelectedAnnotationsAsync(IEnumerable<string>)
Selects annotations with sent annotation ids.
Declaration
Task SetSelectedAnnotationsAsync(IEnumerable<string> annotationIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | annotationIds | Ids of annotations to be selected. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents an asynchronous operation of selecting annotations using their id. |
UpdateAnnotation(IAnnotation)
Updates sent annotation.
Declaration
Task UpdateAnnotation(IAnnotation updatedAnnotation)
Parameters
| Type | Name | Description |
|---|---|---|
| IAnnotation | updatedAnnotation | Updated annotation. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents an asynchronous operation of updating an annotation. |
Events
| Edit this page View SourceAnnotationsChanged
This event will be emitted whenever the annotations change either due to a user action (eg. clicking the UI) or via APIs. The change event will fire before all specific events and it could be used in case you want to perform some action regardless of which event caused the annotation to "change" (create, delete, update, load, internal load, etc). Consider using the specific events for more advanced use cases.
Declaration
event Action AnnotationsChanged
Event Type
| Type | Description |
|---|---|
| Action |
Remarks
The event might also be emitted every time the list of annotations changes. This for example can happen when scrolling to a page and PSPDFKit loads the annotations for that page or when opening the annotations sidebar and PSPDFKit loads all the document annotations.
AnnotationsChanging
This event will be emitted when the user starts or ends an interaction with an annotation. AnnotationsChangingReason for list of possible reasons for this event being fired.
Declaration
event IAnnotationManager.AnnotationsChangingEventHandler AnnotationsChanging
Event Type
| Type | Description |
|---|---|
| IAnnotationManager.AnnotationsChangingEventHandler |
Remarks
Note that this event is only emitted for actions performed through the UI. Despite the name, it is not necessarily fired before each emission of AnnotationsChanged, since that would not correspond to the list of possible reasons described in AnnotationsChangingReason on all cases.
AnnotationsCreated
This event will be emitted whenever new annotations were created (either via the public API or via the UI).
Declaration
event IAnnotationManager.AnnotationEventHandler AnnotationsCreated
Event Type
| Type | Description |
|---|---|
| IAnnotationManager.AnnotationEventHandler |
AnnotationsDeleted
This event will be emitted whenever annotations were deleted (either via the public API or via the UI).
Declaration
event IAnnotationManager.AnnotationEventHandler AnnotationsDeleted
Event Type
| Type | Description |
|---|---|
| IAnnotationManager.AnnotationEventHandler |
AnnotationsLoaded
This event will be emitted whenever annotations are loaded from the annotation provider. This can happen more than once since we often load annotations on demand only.
Declaration
event IAnnotationManager.AnnotationEventHandler AnnotationsLoaded
Event Type
| Type | Description |
|---|---|
| IAnnotationManager.AnnotationEventHandler |
AnnotationsSaved
This event will be emitted whenever annotations were saved. This event is always preceded by AnnotationsSaving event.
Declaration
event Action AnnotationsSaved
Event Type
| Type | Description |
|---|---|
| Action |
AnnotationsSaving
This event will be emitted before annotations will be saved. This happens whenever attributes of the annotation change (either via the public API or via the UI) and the annotation is in a valid state. This event will always be followed by AnnotationsSaved event.
Declaration
event Action AnnotationsSaving
Event Type
| Type | Description |
|---|---|
| Action |
AnnotationsUpdated
This event will be emitted whenever annotations were updated (either via the public API or via the UI).
Declaration
event IAnnotationManager.AnnotationEventHandler AnnotationsUpdated
Event Type
| Type | Description |
|---|---|
| IAnnotationManager.AnnotationEventHandler |