Skip to main content
4everJang
Legend
December 13, 2021
Answered

How do I open a PDF page via scripting ?

  • December 13, 2021
  • 3 replies
  • 1049 views

I am extracting some layout information from PDF pages using ExtendScript in Illustrator. This works fine but as I need to automate the entire process, I am now looking for a method to open an existing PDF on a specified page in Illustrator from ExtendScript. The scripting reference just mentions the open( ) function with very little details on available options. Is there a more elaborate reference to be found somewhere?

If experienced scripters (or Adobe developers) know that my task is impossible to automate, please let me know so I can stop this wild goose chase before it eats up all my budget. But of course I would prefer finding a method to do what I intend to do.

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer femkeblanco

To open page 2 of the PDF file "pdf1" on my desktop:

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var options1 = app.preferences.PDFFileOptions;
options1.pageToOpen = 2;
open(new File("~/Desktop/pdf1.pdf"), DocumentColorSpace.CMYK);

 

3 replies

femkeblanco
femkeblancoCorrect answer
Legend
December 13, 2021

To open page 2 of the PDF file "pdf1" on my desktop:

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var options1 = app.preferences.PDFFileOptions;
options1.pageToOpen = 2;
open(new File("~/Desktop/pdf1.pdf"), DocumentColorSpace.CMYK);

 

4everJang
4everJangAuthor
Legend
December 13, 2021

In FrameMaker scripting the options for opening are passed in the Open( ) method, so I never looked at generic app properties for this. It works beautifully. Thanks a bundle.