QUESTIONS OR COMMENTS ABOUT PRODUCTS? WRITE US AT SUPPORT@BYTESCOUT.COM OR USE THIS FORM

Example: how to add and use javascript code actions in PDF documents generated using PDFDoc Scout library

Sample: using javascript code in PDF documents made with PDFDoc Scout library

Download example source code: pdfdocscout_example_java_script_action.zip (55,6 KB)

Screenshot (view produced pdf):

pdf document generated with PDFDoc Scout demonstrating javascript functionality support in PDF document

 ' create PDFDoc object

 
Set PDFDoc = CreateObject("PDFDocScout.PDFDocument")

 
' initialize library

 
PDFDoc.InitLibrary "demo""demo"

 

 
' set output filename for PDF document

 
PDFDoc.OutputFileName "pdfdocscout_example_java_script_action.pdf"

 
' automatically open generated PDF document in default PDF viewer application

 
PDFDoc.AutoOpenGeneratedPDF = true



 
' starts PDF document generation

 
PDFDoc.BeginDocument



 
'Add new Java Script Action

 
Set JavaScriptAction PDFDoc.AddJavaScriptAction("app.alert('demo Java Script Action')")

 

 
' Add button

 
Set btnTest PDFDoc.Page.AddButton("btnDemo"100150200110)

 btnTest.Caption 
"Run Java Script Action"

 
' Set button action

 
btnTest.OnMouseDown JavaScriptAction



 
' close pdf document generation

 
PDFDoc.EndDocument



 
' disconnect from library

 
Set PDFDoc = Nothing

Download example source code: pdfdocscout_example_java_script_action.zip (55,6 KB)

 

Tutorials: