title: How to use PDFBox to create a link that goes to *previous view*?
body: <p>By using PDFBox, it is easy to create a link that goes a particular page or page view by using <code>PDPageDestination</code>.  For example, the following code will make a link that goes to page 9:</p>
  
  <pre><code>PDAnnotationLink link         = new PDAnnotationLink();
  PDPageDestination destination = new PDPageFitWidthDestination();
  PDActionGoTo action           = new PDActionGoTo();
  
  destination.setPage(document.getPage(9));
  action.setDestination(destination);
  link.setAction(action);
  </code></pre>
  
  <p><strong>Problem:<br></strong>
  Instead of going to a particular page, I would like to go to the previous <strong>view</strong>.</p>
  
  <p>For example, suppose in a PDF file, each of P.1 and P.2 has a link that goes to P. 9.  Now I would like to put on P. 9 a link that goes back to where the user started.  </p>
  
  <p>If the user started out at P.1 and clicked the link to P.9, he arrives at P.9.  When he clicks the link on P. 9, he will go back to P.1, where he came from.  But If he started out at P.2, then the link at P.9 will go back to P.2 instead.</p>
  
  <p><strong><em>Question:   How do I achieve this with PDFBox?</em></strong></p>
  
  <p>FYI, with Adobe Acrobat, this can be achieved by adding an "execute a menu item" action to a link, and then choosing "Previous View" as the menu item, as shown in this screenshot:</p>
  
  <p><a href="https://dl.dropboxusercontent.com/u/13566649/sample.jpg" rel="nofollow noreferrer">Link to Acrobat screenshot</a></p>