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

Controlling Window Tiles with JavaScript?

asmohr
Registered: Sep 2 2007
Posts: 25

I'm trying to control how I have two documents open at the same time in a Reader window using JavaScript. I need to control both size and position of the windows for both documents.

One document I have NO control over; it's a pre-existing PDF that I do not have copyright permission on. However, everyone in my audience has a copy of it. I have created an Annotation/Errata document that I want to open next to the original document in Tiled Windows.

I have created buttons in the Errata that will open the original to specific pages according to which button is clicked. So far GREAT. (I have not coded it, but I presume I can create a Start function that will open the original doc when the Errata is opened.)

Right now, when the second (original) document is opened and I manually go to vertical tiling (Shift+Ctrl+L or Alt+W > T > V) the second doc is always on the left. The Errata may read better if it is on the left instead. Also, the Errata is formatted to a much narrower page so that the original can be presented as wide as possible. But the Window > Tile command makes them the same width by default. It would actually be better for usability/readability if I could position the windows so there is a small overlap instead of strict tiling.

Is there any way in JavaScript to emulate the function of the Window > Tile commands while controlling the positions of the two documents within the overall Reader window?

I have pored over the AcroJS reference doc and come up empty. Any suggestions?

Thanks,
August

asmohr
Registered: Sep 2 2007
Posts: 25
I got a couple of "ask an expert" suggestions from Eugene Williams and Thom Parker.

The doc has useful info, but you cannot use those command line parameters with a link or button in a document.The method app.execMenuItem(TileVertical") does a big chunk of what I want. I can stack functions under the same Link or Button; the first opens the doc, the second sets the Tile Vertical layout. However, I cannot control which doc is at left or right nor can I change the automatic horizontal space assigned to each doc.

I found doc.innerAppWindowRect and doc.outerDocWindowRect. I wish I could use innerAppWindowRect to get the current space available and then with a little arithmetic figure out how to reset outerDocWindowRect for each document to postition them the way I want. Unfortunately, those properties are listed with an Access code of "R".

So I may have to punt and get part way there with app.execMenuItem and then have a popup comment to the user that explains how to adjust the widths of the document windows for best usability. Not pretty, but it will get things off the ground.
asmohr
Registered: Sep 2 2007
Posts: 25
Whichever doc is the current doc when you issue the Tile command is the one that ends up on the left side of the tiled window.