HelpBot Assistant

How can I help you?

PDF form import and export events in JavaScript

12 Feb 20262 minutes to read

Import/export events let users track and customize the lifecycle of form data imported into or exported from the PDF Viewer.
Use these events to:

  • validate inputs before processing
  • show progress indicators
  • log audit trails
  • block operations based on business rules

Each event provides detailed context through typed event arguments such as ImportStartEventArgs, ImportSuccessEventArgs, ImportFailureEventArgs, ExportStartEventArgs, ExportSuccessEventArgs, and ExportFailureEventArgs.

Import events

Example: Handle import events

// ...viewer initialization...
viewer.importStart = function (args) {
  console.log('Import started', args);
  // e.g. show spinner, validate inputs
};
viewer.importSuccess = function (args) {
  console.log('Import success', args);
  // e.g. hide spinner, show toast
};
viewer.importFailed = function (args) {
  console.error('Import failed', args);
  // e.g. show error dialog
};

Export events

Example: Handle export events

// ...viewer initialization...
viewer.exportStart = function (args) {
  console.log('Export started', args);
  // e.g. disable export UI
};
viewer.exportSuccess = function (args) {
  console.log('Export success', args);
  // e.g. enable UI, provide download link
};
viewer.exportFailed = function (args) {
  console.error('Export failed', args);
  // e.g. re-enable UI, notify user
};

Key notes

  • importStart, importSuccess, importFailed cover the full import lifecycle.
  • exportStart, exportSuccess, exportFailed cover the full export lifecycle.

See also