You can do this in a couple of ways.
- If you have Named Destinations in your target file you can use the cDest parameter of openDoc to automatically jump to one of them when it is opened.
- If you want to link to a page or a specific view state you will need to make sure that the file you're linking to is disclosed, and then the openDoc method will reuturn a doc object, which you could manipulate to do that (by setting the pageNum property, for example).
Thanks, but I may not have represented my question accurately enough (sorry, been a long couple days with a corrupted PDF, defective USB media, and other issues on an unexpected deadline)
I tried using a set of hidden buttons, setting their onFocus/onBlur action to the 'Go to page view', but there were issues with that (the parent PDF would always be re-activated right after the embedded PDF was opened)
For now, I've recreated the popup options with a set of buttons, and that may do what I want, although the new version (which i believe is an improvement to the original with the popup) may not be approved by the client (my original suggestion was to change the layout of the piece to allow for the options as buttons instead of a popup, but I am not allowed to make those changes).
1 person found this helpful
The answer is no, I'm afraid. Using JS you can only create JS actions.
One of the things I had looked for was a way to activate an existing link through JS, but the Link class only has one method 'setAction'.
I believe that the new version I have been working on replacing the dropdown with an array of buttons will do what I need to.
Appreciate the assistance.
Are you linking to just a page (by setting the pageNum property), or do you
need to link to a specific point in the page?
No, I'm just trying to open up the attachment to the first page @ fit page view. Essentially, I need to open an attached PDF from a dropdown once a choice is selected (via mouse click, or keyboard commit).
The non-JS way I found to open an attachment is to use the 'Go to page view' action which does what I need. But this works only as an action, which is fine for the items which are opened via a button. The dropdown does not have a 'selection changed/committed' action, so I have to open the attachment via JS in the validate event, but the code I posted first was not working consistently. Perhaps I was doing something wrong, but at times it would work in Pro but not Reader, other times I got an error (invalid argument type) even though I copied the filename directly from the attached file, and verified that I was using the correct filename for the attachment.
If there is a better solution that I am missing, I am open to any other suggestions.