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

Zooming into pictures

Scrimmy
Registered: Jan 5 2011
Posts: 2

Can anyone tell me the best way to create a button that when clicked zooms into a photo on the page at a set %. Im creating a furniture catalogue that has 18 small ish photos and I just want the user to click to zoom in and back out again.
Im using indesign and Acrobat 9.

My Product Information:
Acrobat Pro 9.4, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This has to be done in JavaScript to get the zoom factor right. So your button could execute this code.

this.zoom = 200;


But getting it right is much more difficult because you need to zoom to a specific location on the page. One easy way to do this, but its not always exact, is to set the focus to a specific element so that that element is centered on the screen. So, place an invisible button over the image and modify the code to this.

this.zoom = 600;
this.getField("image1").setFocus();

Or, if the zoom button is the button that's over the image.

this.zoom = 600;
event.target.setFocus();



And to zoom out do this modification.


if(this.zoom == 600)
this.zoom = 100;
else
{
this.zoom = 600;
event.target.setFocus();
}



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

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
Another approach is to zoom into the image as you want and then create a named destination. In the button, use the gotoNamedDest method: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.496.html

The MouseUp script would like:

gotoNamedDest("your_dest");

where "your_dest" is the name you gave the named destination.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
That's a good one George!!
Then use app.goBack() to restore the previous view.

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

rbogie
Registered: Apr 28 2008
Posts: 432
also, you can do the same without JS, simply by pointing the button's action to a named destination. here is a link to an exemplar https://acrobat.com/#d=Xf1xK-FTgOxiBdiyzI2P0Q
where the named destination is set to zoom the graphic at 250%
Scrimmy
Registered: Jan 5 2011
Posts: 2
Thanks very much for the ideas guys its very much appreciated.