Forum How do I...?

Add JavaScript code into the PDF document

avishnya
Hi there,

Acrobat Pro allows users to add javascript code to the document (see example below). Can the same be achieved with Prince?

Example:
//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------

//<AcroForm>
//<ACRO_source>formfield_1:Annot1:OnBlur:Action1</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:formfield_1:Annot1:OnBlur:Action1 ***********/
var formfield1 = this.getField("formfield_1");
var formfield2 = this.getField("formfield_2");

if (formfield1 !== null && formfield2 !== null) {
    formfield2.value = formfield1.value; 
}
//</ACRO_script>
//</AcroForm>
mikeday
There is the prince-pdf-script property:
@prince-pdf {
    prince-pdf-script: "JavaScript goes here"
}

This allows you to enter JavaScript that Acrobat will run when the PDF is opened.