Skip navigation
Currently Being Moderated

pageToOpen for opening PDF not working

May 2, 2012 5:20 AM

Tags: #pdf #open_pdf #pagetoopen

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.

 
Replies
  • Currently Being Moderated
    May 2, 2012 6:04 AM   in reply to Graham van de Ruit

    Have you tried setting the application user interaction preference? You should also take a look at Carlos's script for AI pdfs…

     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2012 10:52 AM   in reply to Graham van de Ruit
    var uIL = userInteractionLevel;       
    app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    // Rest of your script goes between…
    app.userInteractionLevel = uIL;
    

     

    Carlos… script is here…

     

    http://forums.adobe.com/thread/946055

     
    |
    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