Skip to main content

Events

Version: 11.0

Events

The following events can trigger any valid Actions.

Page Reader Events​

The following events can be triggered for each page in a PDF.

  • Open - This event will be fired when opening a specific page.
  • Close - This event will be fired when closing a specific page.

The example below demonstrates how to trigger a JavaScript alert window when a specific page is opened.

Page page = new Page();
JavaScriptAction action = new JavaScriptAction("app.alert(\"Welcome !!\")");
page.ReaderEvents.Open = action;
Dim page As Page = New Page()
Dim action As JavaScriptAction = New JavaScriptAction("app.alert('Welcome !!')")
page.ReaderEvents.Open = action

Document Reader Events​

The following events can be triggered at the document level.

  • WillSave - This event will be fired when saving a document.
  • DidSave - This event will be fired after saving a document.
  • WillClose - This event will be fired while closing a document.
  • WillPrint - This event will be fired when printing a document.
  • DidPrint - This event will be fired after printing a document.

The example below demonstrates how to trigger a JavaScript alert window when saving a PDF.

Document document = new Document();
JavaScriptAction action = new JavaScriptAction("app.alert(\"Hello your text Saved!!\")");
document.ReaderEvents.WillSave = action;
Dim document As Document = New Document()
Dim action As JavaScriptAction = New JavaScriptAction("app.alert('Hello your text Saved!!')")
document.ReaderEvents.WillSave = action

Form Field Reader Events​

The following events can be triggered for each form field.

  • MouseUp- This event is fired when the mouse button is released after a click.
  • MouseDown - This event is fired when the mouse button is clicked and not released.
  • MouseEnter - This event is fired when the mouse pointer enters the field.
  • MouseExit - This event is fired when the pointer exits the form field.
  • OnBlur - This event is fired when the form field loses focus.
  • OnFocus - This event is fired when the form field receives focus, either through a mouse action or by tabbing.

The example below demonstrates how to trigger a JavaScript alert window when a text field receives focus.

TextField textField = new TextField("Text1", 0, 0, 100, 15);
JavaScriptAction action = new JavaScriptAction("app.alert(\"Welcome !!\")");
textField.ReaderEvents.OnFocus = action;
Dim textField As TextField = New TextField("Text1", 0, 0, 100, 15)
Dim action As JavaScriptAction = New JavaScriptAction("app.alert('Welcome !!')")
textField.ReaderEvents.OnFocus = action