Import/Export events for annotations
14 Jan 20261 minute to read
Import/Export events let you track and customize the full lifecycle of annotation data flowing into and out of the PDF Viewer.
Use them to validate inputs, show progress UI, log audit trails, or block operations based on your business rules. Each event exposes typed event-args (ImportStartEventArgs, ImportSuccessEventArgs, ImportFailureEventArgs, ExportStartEventArgs, ExportSuccessEventArgs, ExportFailureEventArgs) describing the operation context.
Import events
- importStart: Triggers when an import operation starts.
- importSuccess: Triggers when annotations are successfully imported.
- importFailed: Triggers when importing annotations fails.
Handle import events
viewer.importStart = function(args) {
console.log('Import started', args);
};
viewer.importSuccess = function(args) {
console.log('Import success', args);
};
viewer.importFailed = function(args) {
console.error('Import failed', args);
};Export events
- exportStart: Triggers when an export operation starts.
- exportSuccess: Triggers when annotations are successfully exported.
- exportFailed: Triggers when exporting annotations fails.
Handle export events
viewer.exportStart = function(args) {
console.log('Export started', args);
};
viewer.exportSuccess = function(args) {
console.log('Export success', args);
};
viewer.exportFailed = function(args) {
console.error('Export failed', args);
};Notes:
- importStart/importSuccess/importFailed cover the lifecycle of annotation imports.
- exportStart/exportSuccess/exportFailed cover the lifecycle of annotation exports.