Forum How do I...?

Back navigation in a PDF

wgardner
Is it possible to create a button or link in the headers of my documents to go BACK after clicking on a link in the document?... something similar to BACK and FORWARD navigation buttons in web browsers...
mikeday
Back to where?
joelmeador
In HTML, we might write:
<a href="javascript:history.back()">Go Back</a>

And I think that is the functionality that's being looked for. My research uncovered Acrobat has a lot of support for actions like these: http://tex.stackexchange.com/questions/51320/going-back-when-using-hyperref.

More context: @wgardner reached out to us on DocRaptor trying to solve this problem and I couldn't get anything to work, so hopefully you have some ideas, @mikeday!
wgardner
Correct -- I already have links to major sections, but I am creating links throughout my documents (many times linking to the same place) and so those links may be coming from anywhere in the document. When the user click the page I want them to go back to where they clicked (whether that is on page 33, 57 or 102....).
mikeday
Technically it would probably be better for the reader to just use whichever back button is present on their PDF viewer of choice. We could support a new URL scheme for links like pdf-action:GoBack, but this is non-standard and will only work in Acrobat and other viewers which already have a back button.
joelmeador
Yeah, all the PDF viewers I use regularly have a back button (or back key sequence at least). I haven't tried producing a PDF with the acrobat specific actions in it yet, but I'm curious how proprietary it is. That's my exercise for today for the OSX readers I use. I'll report anything interesting (or not) I find.
mikeday
You can test with this PDF I just generated which includes a few actions like NextPage and non-standard actions like GoBack.
  1. action.pdf39.0 kB
joelmeador
Thanks, Mike! That greatly sped up the process.

Things the buttons do work in:
  • Adobe Acrobat Reader DC (2015)
  • Preview (8.1)
  • Skim (1.4.20)

Things the buttons don't work in:
  • PDFPen (8.0.2) - doesn't support links, no forward/back key combo
  • Firefox (47.0.1) - no forward/back key combo
  • Safari (9.1.1) - no forward/back key combo
  • Chrome (51.0.2704.103) - doesn't support links, no forward/back key combo

Edited by joelmeador

joelmeador
@mikeday: I realize this is probably not going to be available for a bit, but do you feel like it is a reasonable feature to add? I can make a feature request on that forum if you want.
mikeday
I've already added it. :D
joelmeador
Pro Moves. Thanks, Mike!
mikeday
The latest build with this feature is now available. It can be used by specifying a link with the pdf-action: URL scheme, eg. href="pdf-action:GoBack".