27 Replies Latest reply on Jan 21, 2016 3:04 AM by Bernd Alheit

    Help adding an image to pdf with buttonImportIcon

    owaind29065507 Level 1

      Hi,hoping someone can help me with this as I am pulling my hair out.


      I create a button using the addfield command as follows


      var cFileName = "somepathhere/filename.pdf";

      var oFld = this.addField("ButtImage", "buton", this.pageNum, [222,417,363,496]);

      if(oFld != null)


           oFld.buttonPosition = position.iconOnly;

           oFld.borderStyle = border.s;

           oFld.textColor = color.black;

           oFld.lineWidth = 1;




           MyImportIcon(this.getField("ButtImage"), cFileName);

      } catch(e) {

           console.println("Error Importing Signature Image")




      then I have a seperate js file MyImportIcon.js

      var MyImportIcon = app.trustedFunction(function(oFld, cPath)



      if(cPath != null)


           oFld.buttonImportIcon(cPath, 0);









      When this code all runs I get no errors in the console, a button is created in the pdf but it is blank and no icon is set. 


      I am running Acrobat X Standard.


      Thanks in advance for your responses.