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
-
importStart— Fires when an import begins. -
importSuccess— Fires when form fields are successfully imported. -
importFailed— Fires if the import fails.
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
-
exportStart— Fires when an export begins. -
exportSuccess— Fires when form fields are successfully exported. -
exportFailed— Fires if the export fails.
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,importFailedcover the full import lifecycle. -
exportStart,exportSuccess,exportFailedcover the full export lifecycle.