3 Replies Latest reply on Jul 6, 2008 11:29 AM by Loic.Aigon

    Export of multiple pdf files, with different ranges ?

      Hello

      I am really trying to figure this one out.

      I am trying to export several PDF files form one document at once by defining ranges such as:

      Page 1 -> 1.pdf
      Page 2-3 -> 2.pdf
      Page 3 -> 3.pdf
      Page 4-6 -> 5.pdf

      Does anyone know a batch export-scripting method that can not only export multi-pdf files at once but also work with not just single pages but different ranges ?

      Kind regards
      Rosberg
        • 1. Re: Export of multiple pdf files, with different ranges ?
          Loic.Aigon Adobe Community Professional
          Hi
          Your request is really simple.
          The only "difficulty" is to repeat the Export function through a loop for the number of export ranges you want to specify.
          The range itself may be determined in the PDF export preferences.
          var myrangearr = ["1","2-3","3","4-6"];
          var myFolder = Folder.selectDlg();
          var myPDFExportPreset = "High Quality"; //May match one of your PDF presets name !
          //Or a directory you already know or better the folder containing the genuine file.
          for(var i = 0; i < myrangearr.length; i++)
          {
          app.pdfExportPreferences.pageRange = myrangearr[i];
          myFilePath = myFolder + / + myfilename +"_" + myrangearr[i] + .pdf;
          myFile = new File(myFilePath);
          myDocument.exportFile(ExportFormat.pdfType, myFile, false, myPDFExportPreset);
          }
          If you take time to specify correctly the export folder and myPDFExportPreset, it should do the trick.
          Loic
          • 2. Re: Export of multiple pdf files, with different ranges ?
            [Jongware] Most Valuable Participant
            You could put the number of pages as a label into the first page of each set, i.e., in page 1 put "1", in page 2, "2", in page 4, "1" etc.
            Then loop over all pages, exporting the ones with a page label, with the number of pages in that same label.

            Advantage: you can insert and remove any set at will, and it'll work just fine. The array in Loic's script is fixed.

            Disadvantage: you need another script to set the page labels (can't do that in the UI -- but it's a real easy script); and you should be careful removing and inserting pages at the right places, not in the middle of an existing set.
            • 3. Re: Export of multiple pdf files, with different ranges ?
              Loic.Aigon Adobe Community Professional
              I am quite fond of dialog box for this kind of purposes.
              A single prompt does the trick.
              var myrangeinput = prompt ("Enter a range of page separated by commas.","", "page range PDF exporter");
              var myrangearr = new Array();
              myrangearr = myrangeinput.split(",");
              At this point a control loop may be useful to ensure that pages ranges are valid, otherwise the script will fail.
              Will think about that tommorow.
              Loic