How can I AppleScript placing a page from pdf into a layer
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