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

Button to return to 'top level' page from any 'sub-level' page?

HarryP
Registered: Jan 9 2010
Posts: 32
Answered

I'm creating a PDF document consisting of a sequential-pages 'top level' narrative, which refers via links to 'sub-level' reference source documents (themselves arranged in a continuous sequence after the narrative pages section of the document). These 'sub-level' reference pages are cross-linked.

Readers can follow the sequential narrative pages by clicking 'next' page, or scrolling down. However, if they refer to a (linked) 'sub-level' source document, it would then be possible to continue following the cross-linking (or scrolling through them) until - as far as any 'previous view' button is concerned - the relevant narrative page is left way behind. It's enabling a simple return to the narrative where the reader left it that I'm trying to accomplish.

One possible solution (I imagine) would be to set a global variable, possibly on entering each narrative page, or on clicking a reference material link from it, that uniquely identifies that narrative page.

If it were possible to then place a generic 'Return to narrative' button on all the reference material pages, which used that variable to create the link 'on the fly', that would be fantastic.

I've accomplished this in the website version (using a session-cookie set by each narrative page on loading, which automatically stores that page's URL), but I'd appreciate being put out of my misery of investigation if it simply isn't possible to replicate this in Acrobat (9ext).

Obviously, I'd be very happy if someone said "Yes, it is possible, so you put your feet up and have a cup of tea while I write the entire javascript to enable you to do it", but any pointers or assistance will be most welcome.

Thanks for reading this far!

My Product Information:
Acrobat Pro Extended 9.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
It's not clear (to me) from your description if this is a single PDF file, or multiple files (in a package? just in the same folder?).

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

HarryP
Registered: Jan 9 2010
Posts: 32
Hi! Thank you. I appreciate your reply and the point.

It's (currently) one PDF document: the 'sub-level' reference source pages coming after the narrative pages section of the document, e.g.:
One PDF file on a CD, no folders: pages 1-100 narrative pages; pages 101-200 reference pages.

That being said, if there was a way to arrange a 'previous view' to another PDF "in a package", that'd be of much interest too (though so far I'd only glanced at the 'package' option: I'll take another look right away).
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Yes, using a global variable is the way to go. When the user clicks on the button to go to a ref page, save the current's page in this variable, and then use it in the button on the ref page that says to go back to where you came from.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

HarryP
Registered: Jan 9 2010
Posts: 32
Thanks!

Do you know if there's any way, say, when the PDF document enters the page, to id each 'top level' narrative page into the variable automatically (in html jvascript there is a location function), or is it a matter of manually creating an individual id for each 'top level' page?

I'll look into it, but would appreciate a clue about the javascript to create the 'return' button. I'm scraping by with website js but translating it into Acrobat isn't too straight-forward to me.

BTW, packaging isn't appropriate for this project.

Thanks again.
HarryP
Registered: Jan 9 2010
Posts: 32
Since this thread's had a good few views, and I believe this could prove a useful tool, I thought I'd put up my solution thus far. If anyone can improve on it (and I'm sure it could very easily be), I'd be very happy to be upstaged.
I'm making this explanation as paint-by-numbers as possible 'cos being an amateur that's the way I like 'em, ok?

To recap the example, this proposes one pdf document arranged in two main (bookmarked) categories:
# a 'top-level' sequential narrative, with miscellaneous links to
# a 'sub-level' comprised of non-sequential (and possibly cross-linked) reference material.
The idea is that anyone reading the narrative may jump into and browse the reference material as deeply as they want, being able to jump back again, from any reference page, to the narrative on the page they left it, with just one click.


On each of the 'top-level' pages linking to some reference page, create a named destination for the desired view (possibly 'one page at a time' view, or some optimum zoom), and copy the name to clipboard.

On the page's thumbnail, right-click>properties>actions
trigger: page open
action: run a javascript
add: global.myVariable = "myDestinationName";
(where 'myVariable' is your choice of word, and 'myDestinationName' is the name you gave the page view: this can be a long name with spaces, so could be the same as any bookmark for that page)
Ok
Ok


Go to the first reference page and create a button, positioning it where it is least likely to block out content on any reference page (e.g. top right corner).
right-click>properties>general>
tooltip: some text would be good, and maybe 'visible but doesn't print' in the form field menu.
appearance: as you wish, depending on whether you want to use just text or (>options) an icon (e.g. a bookmark symbol).
>actions
trigger: mouse up
action: run a javascript
add (where 'myVariable' is your choice of word): this.gotoNamedDest (global.myVariable);
Ok
Close


Test the above. If all appears well, save the document (in case this bit doesn't work and you want to revert instead of undoing loads of pages), then go back to the first reference page and right-click on the 'return to top-level' link.

N.B. If your reference pages aren't all uniform format (e.g. A4 portrait) bear in mind that you may need to adapt this part to ensure the 'return to top-level' link is sensibly positioned throughout (a landscape page will need reviewing to drag the resulting link into a more suitable position).
>Duplicate
Select the range of pages and click ok.
Acrobat inserts copies of the 'return' link on every page. Since it derives its function from the received global variable, it needs no further modification.