How do I change an image in a button automatically without changing its location?

I have PDF forms, that will have buttons on them, for signature images. These signatures will be located in the exact same location, named the exact same thing, but when I replace the files with new images, I need the image to replace the old with the new.

This seems to be impossible in Acrobat, but was easily done in Live Cycle. From what we can tell, we will need to write a folder level script and place it in the Program Files/Acrobat/JavaScript folder locally on the machine, and then have it override the images once we replace them with new ones.

Has anyone ever had experience with this, and if so, do you have an idea of what type of script we should use, or a sample, please?

Thank you very much for any advice, or help.

Tracy


Tracy Taylor


1 Answer

With Acrobat, write a folder level trusted function script that imports the icon to the button like this:

myIcon = app.trustedFunction( function (){app.beginPriv();
this.getField("Button").buttonImportIcon("C:\\<path to icon file>")
app.endPriv();})

Call the function from a document level script so it imports the icon every time the pdf is opened. If the pdf will be used by others without the folder level script, encase the function in a try/catch:

try{myIcon()} catch(e){};

When you change the icon file (and keep the file name and location the same), it will change on the pdf when you open it.


David Dagley   


Please specify a reason: