ComPDFKit Web SDK
    Preparing search index...

    Interface AnnotationManagerEvents

    Events of AnnotationManager and their listener arguments.

    interface AnnotationManagerEvents {
        addReply: [
            reply: Core.Annotations.Annotation,
            parent: Core.Annotations.Annotation,
            root: Core.Annotations.Annotation,
        ];
        annotationChanged: [
            annotations: Core.Annotations.Annotation[],
            action: "delete"
            | "add"
            | "modify",
            info: {
                creation?: AnnotationCreation;
                imported: boolean;
                isUndoRedo: boolean;
                source?: string;
            },
        ];
        annotationDeselected: [annotations: Core.Annotations.Annotation[]];
        annotationDoubleClicked: [annotation: Core.Annotations.Annotation];
        annotationFocusChanged: [
            annotation: Core.Annotations.Annotation
            | null,
            previous: Core.Annotations.Annotation | null,
        ];
        annotationHidden: [
            annotations: Core.Annotations.Annotation[],
            hidden: boolean,
        ];
        annotationsDrawn: [info: { pageNumber: number }];
        annotationSelected: [
            annotations: Core.Annotations.Annotation[],
            action: "selected"
            | "deselected",
        ];
        deleteReply: [
            reply: Core.Annotations.Annotation,
            parent: Core.Annotations.Annotation,
        ];
        digitalSignatureApplied: [result: SignResult];
        fieldChanged: [field: Field, value: unknown];
        fileAttachmentDataAvailable: [
            annotation: Core.Annotations.Annotation,
            fileInfo: { fileData: Blob; filename: string; mimeType: string },
        ];
        setNoteText: [annotation: Core.Annotations.Annotation, text: string];
        updateAnnotationPermission: [annotation?: Core.Annotations.Annotation];
        widgetHighlightingChanged: [enabled: boolean];
    }
    Index
    addReply: [
        reply: Core.Annotations.Annotation,
        parent: Core.Annotations.Annotation,
        root: Core.Annotations.Annotation,
    ]

    A reply was added (with its direct parent and the root annotation of the thread).

    annotationChanged: [
        annotations: Core.Annotations.Annotation[],
        action: "delete"
        | "add"
        | "modify",
        info: {
            creation?: AnnotationCreation;
            imported: boolean;
            isUndoRedo: boolean;
            source?: string;
        },
    ]

    info.source: 'pagesUpdated' for annotations deleted together with a deleted page (not recorded in undo history).

    const { annotationManager } = instance.Core;
    annotationManager.addEventListener('annotationChanged', (annotations, action, { imported }) => {
    if (imported)
    return; // loaded from the document or imported from XFDF
    annotations.forEach(annot => console.log(action, annot.Id, annot.PageNumber));
    });
    annotationDeselected: [annotations: Core.Annotations.Annotation[]]

    Annotations were deselected.

    annotationDoubleClicked: [annotation: Core.Annotations.Annotation]

    An annotation was double-clicked.

    annotationFocusChanged: [
        annotation: Core.Annotations.Annotation
        | null,
        previous: Core.Annotations.Annotation | null,
    ]

    The focused annotation changed (null when focus was cleared).

    annotationHidden: [annotations: Core.Annotations.Annotation[], hidden: boolean]

    Annotations were hidden or shown.

    annotationsDrawn: [info: { pageNumber: number }]

    Annotations of a page were drawn.

    annotationSelected: [
        annotations: Core.Annotations.Annotation[],
        action: "selected"
        | "deselected",
    ]

    Annotations were selected or deselected.

    const { annotationManager } = instance.Core;
    annotationManager.addEventListener('annotationSelected', (annotations, action) => {
    if (action === 'selected')
    console.log('Selected', annotations.map(annot => annot.Id));
    else
    console.log('Deselected', annotations.length);
    });
    deleteReply: [
        reply: Core.Annotations.Annotation,
        parent: Core.Annotations.Annotation,
    ]

    A reply was deleted.

    digitalSignatureApplied: [result: SignResult]

    sign completed: the signed file, field name and signature field.

    fieldChanged: [field: Field, value: unknown]

    The value of a form field changed.

    fileAttachmentDataAvailable: [
        annotation: Core.Annotations.Annotation,
        fileInfo: { fileData: Blob; filename: string; mimeType: string },
    ]

    The file data of a file attachment annotation is available.

    setNoteText: [annotation: Core.Annotations.Annotation, text: string]

    The contents of a note were changed with setNoteContents.

    updateAnnotationPermission: [annotation?: Core.Annotations.Annotation]

    The current user, admin or read-only state changed (fired every time by setCurrentUser / promote / demote / enable / disableReadOnlyMode, without arguments).

    widgetHighlightingChanged: [enabled: boolean]

    Form widget highlighting was turned on or off.