Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Issues using buttonImportIcon when i import images from the Acrobat Stamp Folder

$
0
0

Hi I am trying to create a Dynamic Stamp that has 1 Field Text Box to show the Date called "Date2" and one button to show the signature as an icon image. The icon of the button need to be imported from the user profile folder:

 

C:\Users\AB111239\AppData\Roaming\Adobe\Acrobat\10.0\Stamps\AB111239.PDF

 

When I use the buttonImportIcon(cPath,0) it returns the value -1, meaning "The selected File could not be opened", now if I change the path to "C:\Users\AB111239\AppData\Roaming\" it does work !!!

 

Any idea about why I cant take the icon image from the Acrobat Stamp Folder?

I just want to have the signature image in a protected folder.

 

Here is the code that I am using.

Any help would be appreciated !!!

 

 

 

 

*********** Script Located in the Custom Calculation Script of a Text Field *****************

if(event.source.forReal && (event.source.stampName == "#s9R3OO8-RCzhI6ekANcHHA")) {

  event.value = (new Date()).toString();
  AFDate_FormatEx("mmm dd, yyyy");


  try {
    MyImportIcon(this.getField("SigButtonImage"),cFileName);
  } catch(e) {
    console.println("Error Importing Signature Image")
  }

}

 

******************** JavaScript Code al Folder ***************************

 

 

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

  app.beginPriv();
  if(cPath != null)
  { // Works for a stamp script
   oFld.buttonImportIcon(cPath,0);
  }
  else
  { // Works for regular PDFs, but not a stamp
   oFld.buttonImportIcon();
  }
  app.endPriv();
});


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>