Pages to Layers Script
Hello,
Background: The job I'm working on was created using datamerge. Its a postcard that has a common master page background. I merged in an address and map.
As expected I now have over 200 pages of postcards with the merged background, address, and map. I need to export them into separate files that have individual names. So what I would like to do is somehow move the pages into layers on a single page and name the layers the file names I need, then export them using the script, "PageExporterUtility". For those not familiar PageExporter lets you choose a base layer and variable data layers on top and creates and individual file for each using the name of that layer.
The problem I'm running into is that I can't find a way to move all of the pages into layers on one page. I found was able to make each page it's own layer but it stays on that page. Here's my script so far below.
Thanks for your help.
Jeff
for(var p=0; p<document.pages.length; p++)
{
var myPageItems = document.pages
.pageItems.everyItem().getElements();
var myLayerPage = (p+1);
for(var i=0;i<myPageItems.length;i++)
{
try{var myLayer = app.activeDocument.layers.add ({name: "Page " + myLayerPage});}catch(e){}
myPageItems.itemLayer = "Page " + myLayerPage;
}
}
