Events

Compatibility Events

Payload contracts for Papyrium compatibility event APIs.

These events are emitted through on and off compatibility APIs.

Example

function onPageChange(payload) {
  console.log('page change', payload.currentPage);
}

instance.on('pageChange', onPageChange);
instance.off('pageChange', onPageChange);

Event contracts

EventPayloadTrigger
annotationModeChange{ mode: PdfAnnotationMode }Fires when annotation editing mode switches.
annotationsChange{ annotations: PdfAnnotation[]; draft?: boolean }Fires when annotation collections are modified.
annotationSelectionChange{ annotations: PdfAnnotation[] }Fires when selected annotations change.
documentLoaded{ pageCount: number; source?: PdfDocumentSource }Fires after a document is fully loaded and page metadata is available.
pageChange{ currentPage: number; pageCount: number; source?: 'scroll' }Fires when active page changes through scroll or direct navigation.
searchChange{ query: string; count: number; activeIndex: number | null }Fires after search query or active match index updates.
selectionChange{ selection: PdfSelection | null }Fires when text selection changes.
statusChange{ status: string }Fires when compatibility status text/state is updated.