These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Is it possible to manipulate images in a PDF with JavaScript?

StevenD
Registered: Oct 6 2006
Posts: 368
Answered

I want to know if it is possible to reposition an image on a page using JavaScript. Let me tell what I am doing by hand right now.

I have to replace the image of a signature in several dozen PDF certificates. Right now I have copied the image to the clipboard and select the TouchUp Object Tool then right click and choose paste then move the image into place. It would sure be nice to be able paste the image then run a script to position it in the right place.

StevenD

My Product Information:
Acrobat Pro 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Unfortunately No. Acrobat JavaScript does not have access to images and graphics in the page content, i.e., anything you'd use the TouchUp Object Tool for. There is however a possible solution. Instead of pasting graphics into the page content, paste them into a stamp annotation. The annotations can be moved and coppied with JavaScript, even between documents. The only drawback is that you can't really use JS to position them because JS can't acquire the locations of the original graphics.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

StevenD
Registered: Oct 6 2006
Posts: 368
Rats. Thanks for the answer. I have tried using a signature as a stamp on another small job fix and it worked well enough.

StevenD