4 Replies Latest reply on Oct 9, 2017 6:27 AM by techboy96

    Script 2 pdf outputs?

    Eugene Tyson Adobe Community Professional & MVP

      I'm looking for a workflow solution where it's required to output 2 pdfs, one for production and one for proof.


      Basically, it's a pain in the hoop to create 2 pdfs each time.


      What I'm looking for is a way via script to export to PDF

      Chooses currently open PDF(s)


      Dialog box looks something like:


      PDF Production

      <Choose PDF Joboption> | <Current Filename> | <Choose Location>


      PDF Proof

      <Choose PDF Joboption> | <Current Filename> | <Choose Location> | Append Filename [_xx]


      Be great if the Script recognised current folder the file is in.



      Any help is appreciated.

        • 1. Re: Script 2 pdf outputs?
          Capital Mailing Services

          Are you trying to script out of InDesign or from Acrobat?


          The Currently open PDF? 


          If you are trying to do it with InDesign i was able to read InDesign CS5 Automation Using XML & JavaScript by Grant Gamble and within an afternoon had what you are looking for programmed for our use.


          InDesign CS5 Automation Using XML & JavaScript: Grant Gamble: 9781460915387: Amazon.com: Books


          I have found that when asking here if you have a simple question and can supply some code you are working on people will gladly help. Most of the people answering do this for a living if you need a full solution offer to hire them.

          • 2. Re: Script 2 pdf outputs?
            Eugene Tyson Adobe Community Professional & MVP

            Basically what I need is a script that will export the PDF twice, within the script I can edit it to insert the name of the PDF settings required for each, perhaps.


            That would work.

            • 3. Re: Script 2 pdf outputs?
              TᴀW Adobe Community Professional & MVP

              If I've understood correctly, then something like this should work.


              With a document open, run the script. It will open a Save Dialog which should default to the folder of the current ID document.


              Click ok, and it will export 2 copies of the document to PDF, according to the presets listed at the beginning of the script, and with a suffix attached to the name of the second PDF, as indicated towards the end of the script.


              // BS"D
              // All rights reserved (c) 2015 by Id-Extras.com
              // Free to use and modify but do not delete this copyright attribution.
              // This script will export 2 pdfs of the current document
              // Choose the PDF presets by altering their names below
              // The second PDF gets a suffix added to its name.
              // Modify the line below beginning name2 = to change the suffix.
              // For more InDesign scripts: www.Id-Extras.com
              d = app.activeDocument;
              // Here you can choose the PDF preset
              preset1 = app.pdfExportPresets.itemByName("[High Quality Print]");
              preset2 = app.pdfExportPresets.itemByName("[Smallest File Size]");
              if (!(preset1.isValid && preset2.isValid)){
                  alert("One of the presets does not exist. Please check spelling carefully.");
              if (d.saved){
                  thePath = String(d.fullName).replace(/\..+$/, "") + ".pdf";
                  thePath = String(new File(thePath).saveDlg());
                  thePath =  String((new File).saveDlg());
              thePath = thePath.replace(/\.pdf$/, "");
              name1 = thePath+".pdf";
              // Here you can set the suffix at the end of the name
              name2 = thePath+"_xx.pdf";
              d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1);
              d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);
              1 person found this helpful
              • 4. Re: Script 2 pdf outputs?
                techboy96 Level 1


                Would you please add the function of exporting first PDF in single page and second PDF in spreads?


                I look up pdfPageLayout.PageLayoutOptions.TWO_UP_FACING, and I couldn't figure out how to make this work. Please Help.


                Much appreciated, thank you in advance!