Skip navigation
jmituzas
Currently Being Moderated

Exporting individual pages to PDF / Indesign

Jul 26, 2010 12:49 PM

Have downloaded some sample scripts from

 

http://www.adobe.com/products/indesign/scripting/index.html

 

This is all well and all but it creates a document and prints it as individual pdf files. Yes this is what I wanted but how can I change the script to either let me browse for or call to my own already created .indd file?

 

Please help.

 

Thanks in advance,

regards,

 

jmituzas

 
Replies
  • Currently Being Moderated
    Jul 26, 2010 10:30 PM   in reply to jmituzas

    Hi,

     

    Find below code, now this will run on open indesing file.

     

    //ExportEachPageAsPDF.jsx
    //An InDesign CS4 JavaScript
    //
    //Exports each page of an InDesign CS document as a separate PDF to 
    //a selected folder using the current PDF export settings.
    //Display a "choose folder" dialog box.
     
    main();
     
    function main(){
        mySnippet();
    }
     
    function mySnippet(){
         //<fragment>
         var myPageName, myFilePath, myFile;
         var myDocument = app.activeDocument;
         var myBaseName = myDocument.name.replace(/\.indd/, "");
         var myPDFExportPreset = app.pdfExportPresets.item("[Press Quality]");
         for(var myCounter = 0; myCounter < myDocument.pages.length; myCounter++){
              myPageName = myDocument.pages.item(myCounter).name;
              app.pdfExportPreferences.pageRange = myPageName;
              //The name of the exported files will be the base name + the 
              //page name + ".pdf". If the page name contains a colon (as it will 
              //if the document contains sections), then remove the colon.
              var myRegExp = /:/gi;
              myPageName = myPageName.replace(myRegExp, "_");
              myFilePath = Folder.desktop + "/" + myBaseName + "_" + myPageName + ".pdf";
              myFile = new File(myFilePath);
              myDocument.exportFile(ExportFormat.pdfType, myFile, false, myPDFExportPreset);
         }
    }
     
    

     

     

     

    Shonky

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2010 11:03 PM   in reply to jmituzas

    You can select InDesign file with below code:

     

    var myINDDfile = File.openDialog( 'Select InDesign file','*.indd',false);
    

     


    Shonky

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2011 12:42 PM   in reply to Shonkyin

    Shonky (or anyone!!)...

     

    How can I open a dialogue to choose a path to where I would like the output PDF files to be saved??

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2011 1:28 PM   in reply to mrdior

    Scratch that. I found the solution here... after coming up empty-handed in the ID Scripting Tutorial...

     

    var myPath= Folder.selectDialog ("Choose a Folder");

    myPath = myPath + "/";

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points