Copy link to clipboard
Copied
I am not educated at all in javascript so I need the expertise of someone here to help me please!!!
I came across this page on the old Adobe Forum pages - https://acrobatusers.com/tutorials/popup-menus-part-i .
This sort of popup menu is exactly what I need. But I need it to work so that when someone clicks on the choice it either opens a Word document or a webpage. The Word doc would ideally be an attachment to the PDF. But if that isn't possible then it could be located in the same folder as the PDF.
The code for the popup menu only works on PDF's saved in the same folder. How do I make it work for Word doc's and URL's?
The above link says:
This menu is designed to open PDF documents within a common folder. Note that you’ll want your host document and supporting documents all copied to the same folder. To create a popup menu that opens other documents, add a Button field and then add a Run JavaScript action in the Actions tab. When you click the Add button in the Actions tab, enter the following Acrobat JavaScript code:
var cChoice = app.popUpMenu( ["Human Resources", "eeoAnalysis.pdf", "employeeData.pdf"], ["Customer Forms", "customerID.pdf", "orderForm.pdf", "purchaseOrder.pdf", "corporateOrder.pdf"], ["Employee Forms", "employeeApplication.pdf", "performanceEvaluation.pdf", ] ); app.openDoc((cChoice), this);
Each line within the brackets is a different root menu item. The text appearing within the first quotations marks is a menu title and the remaining text within each set of quotes defines the filenames I want to open when accessing the submenu command. The last line of code instructs Acrobat to open the file selected from a selected menu command.
- Launch an attached Word file:
this.exportDataObject({cName: "My Document.doc", nLaunch: 2});
- Launch a URL:
app.launchURL("http://www.google.com");
Copy link to clipboard
Copied
Launching an external file that isn't a PDF: Not possible.
Launching a website: Possible, using the launchURL method of the app object.
Copy link to clipboard
Copied
If the Word document is an attachment, it can be launched.
Copy link to clipboard
Copied
Yes, that's true... I should have mentioned that attachments can be opened, just not independent files.
Copy link to clipboard
Copied
Okay. If the Word doc is an attachment - how would I code that into the code I inserted in my original post?
Same goes for opening a URL? Let's use google.com as the example URL.
I need it to work in this drop down menu please???
Copy link to clipboard
Copied
There are examples of how to export and launch an attachment here...
Copy link to clipboard
Copied
- Launch an attached Word file:
this.exportDataObject({cName: "My Document.doc", nLaunch: 2});
- Launch a URL:
app.launchURL("http://www.google.com");
Copy link to clipboard
Copied
try67 I really appreciate your help.
And I am going to ask for more.
This is the code for the popup menu. Could you please insert those bits of code in the right places for me in the code below for the popup menu?
Please make the "eeoAnalysis.pdf" say google.com and open the web page and make the "employeeData.pdf" piece say mydocument.com and open the document.
Just ignore the rest and leave it as is. If I can get those two links to work - then I can do the rest.
var cChoice = app.popUpMenu( ["Human Resources", "eeoAnalysis.pdf", "employeeData.pdf"], ["Customer Forms", "customerID.pdf", "orderForm.pdf", "purchaseOrder.pdf", "corporateOrder.pdf"], ["Employee Forms", "employeeApplication.pdf", "performanceEvaluation.pdf", ] ); app.openDoc((cChoice), this);
Copy link to clipboard
Copied
That's not so easily done... There needs to be a way of identifying what type of action to perform by each selection. It can be based on the actual value itself but if that's not possible you would need to either hard-code it or switch to using popUpMenuEx and use a unique return value that identifies both the type of action to perform as well as the action "parameter" (file name/attachment file name/URL/etc.)
If you're interested I can write for you the full code that will do that for a small fee. You can contact me privately (try6767 at gmail.com) to discuss it further.
Copy link to clipboard
Copied
It could actually be done with one call. First you'd check if the selected item has the same name as an existing attachment and if so, launch it, if not, go to the URL.
Copy link to clipboard
Copied
How would you differentiate between local files and attached files?
On Wed, Jun 14, 2017 at 1:04 AM, Joel_Geraci <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Quoting the original question... "The Word doc would ideally be an attachment to the PDF. "
Copy link to clipboard
Copied
I was my understanding that they wanted to have links of all three kinds, not just to attachments and URLs, but also to local files.
Copy link to clipboard
Copied
Hi again,
In answer to what types of links I need. Attachments and URL's.
I am trying to create a PDF document that has this flowchart in it. What I want to happen is that when a user clicks on a box in the flowchart they get a pop up menu that gives them options that relate to that box.
For example, the menu would link to a word doc template, directions on how to use the template, specific details about that task, a web page that lists current vendors, another flowchart document that outlines the subtasks for the tasks, etc.
The word docs would be attached to the PDF as it seems that that is the easiest way to launch a word doc and it is also the easiest way to send them one file that has all the files they'll need attached. If there is another method...please let me know.
The flowcharts and instructions would either be separate PDF's (probably in a pkg) or all in one PDF. I know how to create destinations and bookmarks. I would need to use those in this menu.
If this is something you think you can help me with, I will email you.
Copy link to clipboard
Copied
In that case you can use the method described above: Search the attachments for the selected value. If found, launch it.
If not, treat it as a URL.
You can also analyze the returned value and if it starts with "http" launch it as a URL immediately.
Copy link to clipboard
Copied
Okay thank you for your information. I may be emailing you in the future for help with this code for a fee. At this point we aren't sure if we'll use the popup menu option or not.
Much appreciated!!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now