PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllCreates a JavaScript action in a PDF document.
|
| LONG CreateJavascriptAction ( BSTR scriptContents ) |
Parameters
Return value
Remarks
CreateJavascriptAction is an Action category function that creates a JavaScript action. The described script is compiled and executed by the JavaScript interpreter. Depending on the script, it can interact with the resulting document, such as updating form fields or changing the appearance. Check Adobe Technical Note #5186, "Acrobat Forms JavaScript Object Specification" for the JavaScript script subclass language details.
The return value is an action identifier in document's actions collection and can be used in AddControlToAction, OpenDocumentAction, PDFANNOTATION_OnBeforeFormatting, PDFANNOTATION_OnChange, PDFANNOTATION_OnKeyPress, PDFANNOTATION_OnSetFocus, PDFANNOTATION_OnLostFocus, PDFANNOTATION_OnMouseDown, PDFANNOTATION_OnMouseUp, PDFANNOTATION_OnMouseEnter, PDFANNOTATION_OnMouseExit, PDFANNOTATION_OnOtherControlChanged, PDFPAGE_SetAction, PDFANNOTATION_Action, PDFOUTLINENODE_Action.
Example
{ PDF object is supposed to be created }
PDF.PDFPAGE_CreateControl_Button('Btn1', 20, 90, 65, 105);
PDF.PDFANNOTATION_Caption := 'Alert demo';
actionIndex = PDF.CreateJavascriptAction('app.alert("This window created as result of CreateJavascriptAction")');
PDF.PDFANNOTATION_OnMouseUp := actionIndex;
// PDF object is supposed to be created
PDF->PDFPAGE_CreateControl_Button("Btn1", 20, 90, 65, 105);
PDF->PDFANNOTATION_Caption = "Alert demo";
LONG actionIndex = PDF->CreateJavascriptAction("app.alert(\"This window created as result of CreateJavascriptAction\")");
PDF->PDFANNOTATION_OnMouseUp = actionIndex;
// PDF object is supposed to be created
PDF.PDFPAGE_CreateControl_Button("Btn1", 20, 90, 65, 105);
PDF.PDFANNOTATION_Caption = "Alert demo";
long actionIndex = PDF.CreateJavascriptAction("app.alert(\"This window created as result of CreateJavascriptAction\")");
PDF.PDFANNOTATION_OnMouseUp = actionIndex;
' PDF object is supposed to be created
PDF.PDFPAGE_CreateControl_Button "Btn1", 20, 90, 65, 105
PDF.PDFANNOTATION_Caption = "Alert demo"
actionIndex = PDF.CreateJavascriptAction("app.alert('This window created as result of createJavascriptAction')")
PDF.PDFANNOTATION_OnMouseUp = actionIndex
See Also


