0 Replies Latest reply on Jan 24, 2012 8:17 AM by jmituzas

    How to InDesign CS5 - .jsx script export multiple PDF??

    jmituzas Level 1

      ok I have a datamerge process with .jsx script that is exporting to single page pdf files. What I need it for 2 of these pages to be in one (multi-page pdf). how can I accomplish this?

       

      here is the script I have here is my function & teardown:

       

      function mySnippet(){
                //<fragment>
                var myPageName, myFilePath, myFile;
                var myDocument = app.documents.item(0);
                var myBaseName = myDocument.name;
                for(var myCounter = 0; myCounter < myDocument.pages.length; myCounter++){
                          myPageName = myDocument.pages.item(myCounter).name;
                                  app.pdfExportPreferences.pageRange = myPageName;
      
                          //app.pdfExportPreferences.pageRange = myPageName, "15-16";
              
                  switch(myPageName) {
                          case "1" : myPageName = "Human Card Approval";
                                    docType = ""  break;
                          case "2" : myPageName = "Pet Card Approval";
                                    docType = "" break;
                          case "3" : myPageName = "Rx FAQ EN";
                                    docType = "FAQ" break;
                          case "4" : myPageName = "Rx FAQ ES";
                                    docType = "FAQ" break;
                          case "5" : myPageName = "Labs & Imaging FAQ EN";
                                    docType = "FAQ" break;
                          case "6" : myPageName = "Labs & Imaging FAQ ES";
                                    docType = "FAQ" break;
                          case "7" : myPageName = "Equalizer No Cards EN";
                                    docType = "Equalizer" break;
                          case "8" : myPageName = "Equalizer w_cards EN";
                                    docType = "Equalizer" break;
                          case "9" : myPageName = "Equalizer Slick Stand EN";
                                    docType = "Equalizer" break;
                          case "10" : myPageName = "Equalizer No Cards ES";
                                    docType = "Equalizer" break;
                          case "11" : myPageName = "Equalizer w_cards ES";
                                    docType = "Equalizer" break;
               case "12" : myPageName = "Equalizer Slick Stand ES";
                                    docType = "Equalizer" break;
                          case "13" : myPageName = "Medicare Donut Hole EN";
                                    docType = "Donut Hole" break;
               case "14" : myPageName = "Medicare Donut Hole ES";
                                    docType = "Donut Hole" break;
               case "15" : myPageName = "Trifold EN Outside";
                                    docType = "TriFold" break;
                          case "16" : myPageName = "Trifold EN Inside";
                                    docType = "TriFold" break;
                          case "17" : myPageName = "Pet w Cards EN";
                                    docType = "Pet" break;
               case "18" : myPageName = "Pet Slick Stand EN ";
                                    docType = "Pet" break;
                          case "19" : myPageName = "Pet w Cards ES";
                                    docType = "Pet" break;
               case "20" : myPageName = "Pet Slick Stand ES";
                                    docType = "Pet" break;
                }
      
      
      
      
                          fileName = group + " " + myPageName + " " + date + ".pdf";
        
                          myFilePath = dirPath + docType + "/" + fileName;
                          myFile = new File(myFilePath);
                          myDocument.exportFile(ExportFormat.pdfType, myFile, false);
      
      
                }
      
      
                //</fragment>
        
      }
      //</snippet>
      
      
      //<teardown>
      function myTeardown(){
      }
      

       

      Here is what I need exported as one pdf file:

       

               case "15" : myPageName = "Trifold EN Outside";

                                    docType = "TriFold" break;

                          case "16" : myPageName = "Trifold EN Inside";

                                    docType = "TriFold" break;