Skip to main content
Participating Frequently
May 2, 2012
Answered

pageToOpen for opening PDF not working

  • May 2, 2012
  • 1 reply
  • 1217 views

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.

This topic has been closed for replies.
Correct answer Muppet Mark

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

1 reply

Inspiring
May 2, 2012

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

Participating Frequently
May 2, 2012

Thanks for the reply, Mark.

I haven't tried setting the application user interaction preference. How do I do this, and what does it accomplish?

Do you have a link to Carlos's script?

Muppet MarkCorrect answer
Inspiring
May 2, 2012

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