1 Reply Latest reply on Oct 30, 2015 10:18 AM by George_Johnson

    help to improve javascript function

    omanbux Level 1

      Hi, my bellow code is work fine. this code i'm using to change text fields font size into 10. always font size is not the 10. so what i want to do is, after running this code, it should give popup window to type custom font size & based on that all text fields text size should change. hope my request is clear. thanks in advance.


      my code


      if (app.viewerVersion < 10) {

          app.addMenuItem({ cName: "ChangeFontSize", cUser: "Change Font Size", cParent: "Tools",

          cExec: "ChangeFontSize(this)", cEnable: "event.rc = (event.target != null);"});

      } else {

          app.addToolButton({ cName: "ChangeFontSize", cLabel: "Change Font Size", cTooltext: "Change Font Size",

           cExec: "ChangeFontSize(this)", cEnable: "event.rc = (event.target != null);"});


      function ChangeFontSize(doc) {

          for (var i = 0; i < doc.numFields; i++) {

                 var f = doc.getField(doc.getNthFieldName(i));

              switch(f.type) {

         case "text":

                    f.textSize =10;