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 creates a JavaScript action. The 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 of the document. 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 the 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.
Equivalent in new interface: IPDFDocument4::CreateJavascriptAction.
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 was created as the 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 was created as the 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 was created as the 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 was created as the result of CreateJavascriptAction')")
PDF.PDFANNOTATION_OnMouseUp = actionIndex
See Also


