Class AnnotationManager

Inheritance
AnnotationManager
Implements
Namespace: PSPDFKit.Sdk.Models.Annotation
Assembly: Sdk.dll
Syntax
public class AnnotationManager : IAnnotationManager

Properties

| Edit this page View Source

AnnotationFactory

Gets an instance of annotation factory.

Declaration
public IAnnotationFactory AnnotationFactory { get; }
Property Value
Type Description
IAnnotationFactory

Methods

| Edit this page View Source

AddAnnotationAsync(IAnnotation)

Creates annotation on document.

Declaration
public Task<string> AddAnnotationAsync(IAnnotation annotation)
Parameters
Type Name Description
IAnnotation annotation

Annotation to be added to document.

Returns
Type Description
Task<string>

Annotation Id

| Edit this page View Source

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
public Task ApplyRedactionAsync()
Returns
Type Description
Task

An asynchronous task representing operation of applying redaction.

| Edit this page View Source

DeleteAnnotationsAsync(IEnumerable<IAnnotation>)

Deletes the sent annotations.

Declaration
public 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.

| Edit this page View Source

DeleteAnnotationsAsync(IEnumerable<string>)

Deletes annotations with sent annotation ids.

Declaration
public 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.

| Edit this page View Source

DeselectAnnotationsAsync()

Deselects all annotations.

Declaration
public Task DeselectAnnotationsAsync()
Returns
Type Description
Task

A task that represents an asynchronous operation of deselecting all annotations.

| Edit this page View Source

ExportInstantJsonAsync()

Return a representation of the current document state in Instant Json.

Declaration
public 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.

| Edit this page View Source

FlattenAnnotationAsync(IEnumerable<uint>)

Flattens annotations on selected pages.

Declaration
public 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.

| Edit this page View Source

GetAnnotationsOnPageAsync(uint)

Gets annotations on specified page.

Declaration
public 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.

| Edit this page View Source

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
public Task ImportInstantJsonAsync(JObject instantJson)
Parameters
Type Name Description
JObject instantJson

Instant json object.

Returns
Type Description
Task
| Edit this page View Source

SetSelectedAnnotationsAsync(IEnumerable<IAnnotation>)

Selects the sent annotations.

Declaration
public 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.

| Edit this page View Source

SetSelectedAnnotationsAsync(IEnumerable<string>)

Selects annotations with sent annotation ids.

Declaration
public 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.

| Edit this page View Source

UpdateAnnotation(IAnnotation)

Updates sent annotation.

Declaration
public Task UpdateAnnotation(IAnnotation annotation)
Parameters
Type Name Description
IAnnotation annotation
Returns
Type Description
Task

A task that represents an asynchronous operation of updating an annotation.

Events

| Edit this page View Source

AnnotationsChanged

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
public 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.

| Edit this page View Source

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
public 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.

| Edit this page View Source

AnnotationsCreated

This event will be emitted whenever new annotations were created (either via the public API or via the UI).

Declaration
public event IAnnotationManager.AnnotationEventHandler AnnotationsCreated
Event Type
Type Description
IAnnotationManager.AnnotationEventHandler
| Edit this page View Source

AnnotationsDeleted

This event will be emitted whenever annotations were deleted (either via the public API or via the UI).

Declaration
public event IAnnotationManager.AnnotationEventHandler AnnotationsDeleted
Event Type
Type Description
IAnnotationManager.AnnotationEventHandler
| Edit this page View Source

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
public event IAnnotationManager.AnnotationEventHandler AnnotationsLoaded
Event Type
Type Description
IAnnotationManager.AnnotationEventHandler
| Edit this page View Source

AnnotationsSaved

This event will be emitted whenever annotations were saved. This event is always preceded by AnnotationsSaving event.

Declaration
public event Action AnnotationsSaved
Event Type
Type Description
Action
| Edit this page View Source

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
public event Action AnnotationsSaving
Event Type
Type Description
Action
| Edit this page View Source

AnnotationsUpdated

This event will be emitted whenever annotations were updated (either via the public API or via the UI).

Declaration
public event IAnnotationManager.AnnotationEventHandler AnnotationsUpdated
Event Type
Type Description
IAnnotationManager.AnnotationEventHandler

Implements

IAnnotationManager