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

app.popUpMenu() PDF form

Community Beginner ,
Oct 02, 2016 Oct 02, 2016

Hello All,

I would like to implement a popup-menu in my PDF form. By choosing options in the popup-menu the PDF reader should have the possiblity to open attached files in a new window.

Based on following javascript, attached files "Option1.pdf" etc. in accordance to user`s choice should be opened in a new window.

var cRtn = app.popUpMenu("Option1","Option2","-","Option3","Option4");

Any comments and ideas are highly appreciated.

Best regards

Florian

TOPICS
Acrobat SDK and JavaScript , Windows
1.5K
Translate
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 ,
Oct 02, 2016 Oct 02, 2016

After that line of code add something like this:

this.openDataObject(cRtn + ".pdf");

Translate
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 Beginner ,
Oct 02, 2016 Oct 02, 2016

Hello try67,

many thanks for your prompt reply. In accordance to user`s choice different PDF attachements should be opened in a new window.

For this reason in my opinion an "if" command is necessary. Furthermore how I could make sure that the attached PDF will be opened in a new window?

As I am pnot professional java script programmist, I would be very grateful, if you could help me with the java scriting.

Best regards

Florian

Translate
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 ,
Oct 02, 2016 Oct 02, 2016

You can't specify how the file is opened in the script. That depends on the application.

And I don't see a need for an if-statement. The line of code I provided takes the user's selection and tried to open the attached file that matches it. Isn't that what you wanted?

Translate
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 Beginner ,
Oct 02, 2016 Oct 02, 2016

The main PDF form has 4 attached files, which are opened in a seperate window, depending on users choice.

Is something like this possible to handle by java script app.popUPMenu ?

Translate
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 ,
Oct 02, 2016 Oct 02, 2016

Did you try what I suggested?

Translate
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 Beginner ,
Oct 02, 2016 Oct 02, 2016

I have tried

this.openDataObject(cRtn + ".pdf");  ...unfortunately not working.

Actually trying following script:

var cRtn = app.popUpMenu("Option1","Option2","Option3","Option4");

if (cRtn != "Option1"){

  this.exportDataObject({ cName: "1.pdf", nLaunch: 2 });

} else if (cRtn != "Option2"){

  this.exportDataObject({ cName: "2.pdf", nLaunch: 2 });

} else if (cRtn != "Option3"){

  this.exportDataObject({ cName: "3.pdf", nLaunch: 2 });

}

It is opening attachment in new window, however mixing the attachments. Anz idea, where the bug is?

Translate
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 ,
Oct 02, 2016 Oct 02, 2016

Well, from your original question I had understood that the names of the attached files are identical (except for the file-extension) to the options in the pop-up menu ("Option1" -> "Option1.pdf"), but from the code above it seems that's not the case ("Option1" -> "1.pdf).

In that case you do need an if-condition (although if you used popUpMenuEx then you could specify a return value for each option and the if-condition could be removed).

I think the error is that you're using the wrong operator. You're using the NOT EQUALS-operator ("!=") instead of the EQUALS-operator ("=="). Change it and it should work as you want it to.

Translate
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 Beginner ,
Oct 02, 2016 Oct 02, 2016

try67, it works! Many thanks!

Translate
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 Beginner ,
Oct 02, 2016 Oct 02, 2016
LATEST

As there will be many different attached reference files and the main PDF will get quite heavy, is there also an option to work with download links from server? That means, that through the popup menu files could be downloaded from the server?

Translate
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