Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Does anyone have an example where javascript is used to insert an action with creation of a button?

Community Beginner ,
Jan 05, 2022 Jan 05, 2022

Working on a command that started from an example in Developing Acrobat Applications Using JavaScript and I modified it to look through fields of a form and if any page has a signature field and the field name is like “Performed” then place a button on that page. Got this working now and for the next iteration I would like to insert a lenghty java script or maybe make a custom function and would really appreciate any pointer or examples to modify last line of the example code given.

 

Thanks in advance for any help offered!

 

for (var i=0; i<this.numFields; i++) {
var fname = this.getNthFieldName(i)
var f = this.getField(fname);    
    if (f.name==null || f.type=='button'||f.type=='radiobutton'||f.type=='text') continue;
    if (f.type=='signature' && /Performed/.test(f.name))
     
// Make the buttons
var pp = addField("Button_", "button", f.page,[ 12, 100, 170, 68 ] );
    pp.buttonSetCaption("Check & Sign Test Case");
    pp.strokeColor = color.gray;
    pp.borderStyle = border.b;
    pp.linewidth = 11;
    pp.fillColor=color.blue;
    pp.textSize = 12;
    pp.textColor = color.white;
    pp.setAction("MouseUp", "Insert script here . . ;");
  }

TOPICS
How to , JavaScript , PDF forms
280
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation