Skip to main content
doublechamp
Participant
January 12, 2017
Question

Is it possible to use an array to print page templates from a popup menu? (using Adobe Acrobat Pro X)

  • January 12, 2017
  • 1 reply
  • 687 views

I have a form that has 3 standard pages(fillable) with several templates arranged into three categories (instructions).  I would like for the user to be able to print only the instructional pages needed by selecting them from a menu button. Is it possible to place the templates into an array by category that can be selected from a menu for printing?

var cChoice = app.popUpMenu( "Category A", "Category B", "Category C);

if (cChoice !=null){

    switch (cChoice) {

            case "Category A":

                    var a = new Array("Template_Page1", "Template_Page2", "Template_Page3", "Template_Page4","Template_Page5");

                        for (i = 0; i < a.length; i++){

                        a.spawn(this.numPages, false, false);}

                        //print Category A templates

                break;

            case "Category B":

                        var a = new Array("TemplateB_Page1", "TemplateB_Page2", "TemplateB_Page3");

                        for (i = 0; i < a.length; i++){

                        a.spawn(this.numPages, false, false);}

                        //print Category A templates

                break;

            case "Category B":

                        var a = new Array("TemplateC_Page1", "TemplateC_Page2", "TemplateC_Page3");

                        for (i = 0; i < a.length; i++){

                        a.spawn(this.numPages, false, false);}

                        //print Category A templates

                break;

    }

    }

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
January 13, 2017

I miss this.getTemplate( ... ) in your code.

doublechamp
Participant
January 16, 2017

Okay, I am not sure where this.getTemplate(...) would go in my code.  But here is my attempt at placing the missing statement in group A code.

var cChoice = app.popUpMenu( "Category A", "Category B", "Category C);

if (cChoice !=null){

    switch (cChoice) {

            case "Category A":

                    var a = new Array("Template_Page1", "Template_Page2", "Template_Page3", "Template_Page4","Template_Page5");

                    var b = this.getTemplate(a);

                    for (i = 0; i < b.length; i++){

                        b.spawn(this.numPages, false, false);}

                        //print Category A templates

                break;

Bernd Alheit
Community Expert
Community Expert
January 16, 2017

Read the documentation. The method getTemplate uses only one name as argument, no array.