LONG CreateJavascriptAction ( BSTR scriptContents ) |
This method creates a JavaScript action. The specified 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 the document's actions collection and can be used in OnOpenDocument, OnControlMouseDown and other properties (see Annotations).
{ PDF object is supposed to be created } btn1 := PDF.AddButton(20, 90, 65, 105, 'Btn1'); PDF.AnnotUnicodeCaption := 'Alert demo'; actionIndex := PDF.CreateJavascriptAction('app.alert("Hello.")'); PDF.OnControlMouseUp := actionIndex; PDF.SaveToFile('test.pdf', true);
// PDF object is supposed to be created long btn1 = PDF->AddButton(20, 90, 65, 105, "Btn1"); PDF->AnnotUnicodeCaption = L"Alert demo"; long actionIndex = PDF->CreateJavascriptAction("app.alert('Hello.')"); PDF->OnControlMouseUp = actionIndex; PDF->SaveToFile("test.pdf", true);
// PDF object is supposed to be created long btn1 = PDF.AddButton(20, 90, 65, 105, "Btn1"); PDF.AnnotUnicodeCaption = "Alert demo"; long actionIndex = PDF.CreateJavascriptAction("app.alert('Hello.')"); PDF.OnControlMouseUp = actionIndex; PDF.SaveToFile("test.pdf", true);
' PDF object is supposed to be created btn1 = PDF.AddButton(20, 90, 65, 105, "Btn1") PDF.AnnotUnicodeCaption = "Alert demo" actionIndex = PDF.CreateJavascriptAction("app.alert('Hello.')") PDF.OnControlMouseUp = actionIndex PDF.SaveToFile "test.pdf", true