4 Replies Latest reply on May 4, 2012 2:48 AM by Graham vdR

    pageToOpen for opening PDF not working

    Graham vdR Level 1

      Hi there

       

      I’m trying to create a looping function that will open each page in a multi-page PDF, do some things, then save and close the document. However, the pageToOpen property of the PDFFileOptions object seems to be having no effect—I am prompted to select a page each time.

       

      Here is my code so far:

       

      var fileRef = File.openDialog('Please select the file to be imported:');

      var pdfOptions = app.preferences.PDFFileOptions;

      pdfOptions.pDFCropToBox = PDFBoxType.PDFBOUNDINGBOX;

       

      for(i = 0; i < 10; i++){

          pdfOptions.pageToOpen = i + 1;

          if (fileRef != null) {

              var myDoc = open(fileRef, DocumentColorSpace.RGB);

          }

      }

       

      I’m using Illustrator CS4 on Windows 7.

       

      I’d appreciate any insights.