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

Spawn different page templates from dropdown

New Here ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Hi I'm currently trying to make a pdf spawn different page templates based on the selections from a dropdown and I can't seem to get it to work:

I have the drop down named "Brief Type 3" containing 5 items with export values from 1-5. I also have a button to receive these values.

I have 5 page templates named 'spawn1', 'spawn2' 'spawn3' 'spawn4' 'spawn5'.

I'm using the following:

var sel = this.getField("Brief Type 3").value;

var templateName = "";

switch (sel) {

    case 1 : templateName = "spawn1";

        break;

    case 2 : templateName = "spawn2";

        break;

    case 3 : templateName = "spawn3";

        break;

    case 4 : templateName = "spawn4";

        break;

    case 5 : templateName = "spawn5";

        break;

}

if (templateName != "") {

    var t = this.getTemplate(templateName);

    t.spawn();

}

What am I doing wrong??

Any help would be greatly appreciated.

Thanks

Sam

TOPICS
Acrobat SDK and JavaScript

Views

930

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

correct answers 1 Correct answer

Community Expert , Aug 22, 2018 Aug 22, 2018

Then you need to change this:

t.spawn();

To something like this:

t.spawn({nPage: event.target.page+1, bOverlay: false});

Votes

Translate

Translate
Community Expert ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Where did you place the code?

Are there any error messages when you run it?

If you don't specify any parameters for the spawn method it will spawn the template over the existing first page of the file. It won't create a new page. Is that what you want to happen?

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
New Here ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Hi, I placed the code on a mouse up on the OK button, I'd like all spawned pages to go after the page that is generating it, i.e. the one with the dropdown/ok button.

Thanks

Sam

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
New Here ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

There are also no error messages

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 ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Then you need to change this:

t.spawn();

To something like this:

t.spawn({nPage: event.target.page+1, bOverlay: 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
New Here ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Thanks try67 but still getting the same result, or no result. The button reacts but the dropdown just resets to default and no page is spawned!

I'm lost!

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
New Here ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

I'm just going to use radio buttons instead.

Thank you for your help anyway!!

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 ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Can you share the file with us (via Dropbox, Google Drive, Adobe Send & Track, etc.)?

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
New Here ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

wetransfer link below:

https://we.tl/t-b0XYU9L61P

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 ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

Works fine for me, although I don't like the use of the list box for that. You should convert it to a drop-down field.

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 ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

It works in Acrobat Reader DC and Adobe Acrobat DC.

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
New Here ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

LATEST

Thank's both, it seems its an issue with my acrobat install, just tried it on a colleague's machine and it works!

thanks again!

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