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

Page Close Event

Clivel
Registered: Jan 11 2007
Posts: 6

Hi, I'm trying to create a custom history pop-up menu (using Acrobuttons thanks very much Thom!), so that a User can return to any page of any document he has previously opened in this Reader session.
 
To accomplish this I'm using pageClose scripts on all pages of all my documents.
The pageClose scripts pass documentName and documentPage data to a folder level function that manages the history pop-up.
 
My problem is that the pageClose script does not get triggered in the following circumstance...
-You have document A open at page 2.
-You then open document B
-Document B contains a link to page 2 of Document A. You click that link.
-Document A comes to the front, page 2 is displayed - But no pageClose script runs on Document B (similarly no pageOpen script runs on Document A)
 
I can see the logic of the page scripts running this way, but this won't do for my application.
 
So my question is 'How can I capture a 'page not active any longer' event?
 
The Javascrpt references seems to hint that this is possible (using the Page/Close event captured at a folder level?). The guides states for this event:
"This event happens whenever the page being viewed is no longer the current page; that is,
the user switched to a new page or closed the document"
 
Any ideas would be gratefully received.
Clive.

My Product Information:
Reader 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
PageOpen, WillClose, and other such events are "Document" scripts, not folder level. The script has to actually be in the document for this to work, and you can't set these actions in Reader. So unless you're only talking about creating a history for docs you've created forget about this method.

Instead you need something that polls Acrobat. Like a timer, or an enable script on a toolbar button. All you have to do is capture the current document path and page number. When these values change you add them to the list. Ta Da, done. Of course this only works for documents in the current session. All this data is lost when the user quits Acrobat. Saving the data is problematic. There are ways to do this but they are version dependant. In Acrobat 5 and maybe 6 you could use the globals object. But not in later versions.

Good Luck,
Thom Parker
WindJack Solutions
[url=http://www.windjack.com]www.windjack.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://partners.adobe.com/public/developer/en/acrobat/sdk/
pdf/javascript/AcroJS.pdf]Acrobat JavaScript Reference[/url]

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