• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Button to View -> Navigation -> Previous View

New Here ,
Mar 13, 2023 Mar 13, 2023

Copy link to clipboard

Copied

I have a PDF File with (2) PDF attachments. On the PDF File, I created links to each of the other PDF attachments. On each of those PDF attachments, I would like to add a button or link that will take the user back to the Main PDF File without having to use View -> Navigation -> Previous View manually. I can't seem to find a way outside of implementing Javascript. 

 

Any ideas? I have no problem using Javascript, I just don't know how to code that. If someone has the code and would like to share it, that would be great!

TOPICS
How to , JavaScript

Views

588

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2023 Mar 13, 2023

Copy link to clipboard

Copied

This has to be done with a script, which means it will only work in Acrobat.

It would be nice if there was something like an oDoc.parentDoc parameter, but there isn't. Documents that are opened in acrobat are not aware of any containing PDF and act independently

There is however a solution. The path of an attachment includes the path to the parent file. So one solution is to extract the path to the parent file and open it. Since it's already open it will be moved to the front. 

 Another solution is to use the use the parent path to find the parent PDF in the app.activeDocs array, and then bring it to the front with the "doc.bringToFront()" function. However, this will only work from a privileged script or if the parent pdf is "disclosed".  

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2023 Mar 14, 2023

Copy link to clipboard

Copied

LATEST

Make the attachment open in a new window, so the user only has to close the new window to return to the first one.
And so your "Back" button should just close the active document.

 

Use this in a Document script to force attachments to open in a new window:

app.openInPlace = false;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines