Skip to main content
Participant
September 20, 2012
Answered

How can I AppleScript placing a page from pdf into a layer

  • September 20, 2012
  • 1 reply
  • 1267 views

I have a PDF file with 25 pages that I need to get into the form of an Illustrator file with 25 layers.

I found the example of opening a particular page of a PDF file (using CS6), and that works.

And I can create layers.

But I can't figure out how to place a particular page of a PDF file into the new layer. Where/how do I provide the page info?

(I have a PostScript program that generates artwork for signs that are to be laser etched at the TechShop. The laser interface uses Illustrator and a special Print driver.

I notice that opening a page from a PDF file positions the contents slightly differently than placing that page, when I do it manually, so I figured I'd create the multilayered Illustrator file by opening one page (which works) then placing all the pages in their own layers, then deleting the first page. Then the positioning will be consistent.

But I'm stuck at placing a PDF page...)

tell application "Adobe Illustrator" to activate

-- This function opens the file passed as

-- a file reference parameter, at page myPage.

-- fileToOpen is a reference to a multi-page PDF file

-- and needs to be set up before calling this function.

on openMultipageFile(fileToOpen, myPage)

          tell application "Adobe Illustrator"

                    set user interaction level to never interact

                    set page of PDF file options of settings to myPage

                    open file fileToOpen without dialogs

          end tell

end openMultipageFile

set myFile to "DBG:Friendship Forest Tree Plaques:FriendshipForestTrees TopAcrossLogo.pdf"

set myPages to 1

openMultipageFile(myFile, myPages)

tell application "Adobe Illustrator"

          set bottomLayer to make new layer ¬

                    at end of document 1 with properties {name:"Layer N2"}

end tell

tell application "Adobe Illustrator"

          set itemPosition to {100.0, 200.0}

          set user interaction level to never interact

          set page of PDF file options of settings to 2

          set placedRef to make new placed item in layer "Layer N2" of document 1 ¬

                    with properties {file:myFile, position:itemPosition}

end tell

This topic has been closed for replies.
Correct answer Larry G. Schneider

You might look at this instead of reinventing the wheel

http://forums.adobe.com/thread/946055?tstart=360

1 reply

Larry G. Schneider
Community Expert
Larry G. SchneiderCommunity ExpertCorrect answer
Community Expert
September 20, 2012

You might look at this instead of reinventing the wheel

http://forums.adobe.com/thread/946055?tstart=360

Participant
September 21, 2012

Wow, that may be just the ticket.

The only thing I'm not sure about is that it does not stack the layers, so I'm not sure how hard it will be to print them each with the same alignment. But I guess I'll have to head for the TechShop and see whether there's any problem.

Anyway, it's sure an easy way to get the whole PDF file into Illustrator!

Thank you! I never would have found it, as I was searching always for Place...