Doc event callback functions

A callback set for document-level event handler.

{
onOpen: (clientData, doc) => {
console.log('When the document is about to open:', clientData, doc);
}
}
interface DocEventCallbacksType {
    onActivate?: (clientData: LPVOIDType, doc: DocType) => void;
    onAnnotKillFocus?: (
        clientData: LPVOIDType,
        doc: DocType,
        focusAnnot: AnnotType,
    ) => void;
    onAnnotSelectionChanged?: (clientData: LPVOIDType) => void;
    onAnnotSetFocus?: (
        clientData: LPVOIDType,
        doc: DocType,
        focusAnnot: AnnotType,
    ) => void;
    onClose?: (clientData: LPVOIDType) => void;
    onDeactivate?: (clientData: LPVOIDType, doc: DocType) => void;
    onFileClose?: (clientData: LPVOIDType, filePath: string) => void;
    onFinishRender?: (clientData: LPVOIDType, docView: DocViewType) => void;
    onOpen?: (clientData: LPVOIDType, doc: DocType) => void;
    onOtherDocActivate?: (clientData: LPVOIDType) => void;
    onOtherDocDeactivate?: (clientData: LPVOIDType) => void;
    onPermissionChange?: (clientData: LPVOIDType, doc: DocType) => void;
    onPrint?: (clientData: LPVOIDType, doc: DocType) => void;
    onSave?: (clientData: LPVOIDType, doc: DocType, isSaveAs: boolean) => void;
}

Properties

onActivate?: (clientData: LPVOIDType, doc: DocType) => void

It is called whenever a document is to be active.

Type declaration

onAnnotKillFocus?: (
    clientData: LPVOIDType,
    doc: DocType,
    focusAnnot: AnnotType,
) => void

It is called when annot kill focus.

Type declaration

    • (clientData: LPVOIDType, doc: DocType, focusAnnot: AnnotType): void
    • Parameters

      • clientData: LPVOIDType

        The user-supplied data.

      • doc: DocType

        It identifies the document opened. It can be used as a unique identifier for the document.

      • focusAnnot: AnnotType

        The focus annot.

      Returns void

onAnnotSelectionChanged?: (clientData: LPVOIDType) => void

It is called whenever a annotation selection changed.

Type declaration

onAnnotSetFocus?: (
    clientData: LPVOIDType,
    doc: DocType,
    focusAnnot: AnnotType,
) => void

It is called when form field changed.

Type declaration

onClose?: (clientData: LPVOIDType) => void

It is called when the document is closed completely.

Type declaration

onDeactivate?: (clientData: LPVOIDType, doc: DocType) => void

It is called whenever a document is to be deactivate.

Type declaration

onFileClose?: (clientData: LPVOIDType, filePath: string) => void

It is called whenever a file is released completely.

Type declaration

    • (clientData: LPVOIDType, filePath: string): void
    • Parameters

      • clientData: LPVOIDType

        The user-supplied data

      • filePath: string

        The file path closed.

      Returns void

onFinishRender?: (clientData: LPVOIDType, docView: DocViewType) => void

It is called when a document view start to scroll automatically.

Type declaration

onOpen?: (clientData: LPVOIDType, doc: DocType) => void

It is called whenever a document is opening.

Type declaration

onOtherDocActivate?: (clientData: LPVOIDType) => void

It is called whenever a non-PDF document is to be deactivated.

Type declaration

onOtherDocDeactivate?: (clientData: LPVOIDType) => void

It is called whenever a non-PDF document is to be deactivated.

Type declaration

onPermissionChange?: (clientData: LPVOIDType, doc: DocType) => void

It is called after the permission of a document is changed.

Type declaration

onPrint?: (clientData: LPVOIDType, doc: DocType) => void

It is called whenever the printer finished work.

Type declaration

onSave?: (clientData: LPVOIDType, doc: DocType, isSaveAs: boolean) => void

It is called when a document is saved completely.

Type declaration

    • (clientData: LPVOIDType, doc: DocType, isSaveAs: boolean): void
    • Parameters

      • clientData: LPVOIDType

        The user-supplied data

      • doc: DocType

        The Document that becomes an active document.

      • isSaveAs: boolean

        A flag indicates whether user click the “save” button or click the “save as” button.

      Returns void