I've got an odd query where I need to take all the objects on a certain layer and put them each on a separate new layer so they can be exported as individual PDFs (and converted to png). I've found a script that does this:
var doc = app.activeDocument;
var myLayer = doc.layers.item("Answers");
for (var i = myLayer.pageItems.length - 1; i >= 1; i--) {
var newLayer = doc.layers.add();
myLayer.pageItems[i].itemLayer = newLayer;
}
This works great, but the layers are just named sequentially. I'm wondering if it's possible to have the new layers named with the page number that the object is on so instead of
Layer 1
Layer 2
etc.
I get:
Page1-1
Page1-2
Page1-3
Page2-1
Page2-2
etc
Is that doable? I've tried finding scripts to get the page number but I can't get it to work (I wish I knew more about Javascript!).
I'm using PageExporterUtility to export all the individual layers as PDFs but because there are many pages that have nothing on a lot of the new layers, I'm getting a lot of blank pages created which I have to sort through and delete manually. I'm thinking if the layers are named with the page numbers I can export just the layers I need for a given page.
I know it's a weird request, any help would be much appreciated.
Thanks, Duncan
Edit: The export process I'm currently using with this is Page Exporter Utility 5.0.1 (here). This exports each layer in the doc as a separate PDF per page. Then I run a Photoshop batch to make them 5500px wide and a png, which is what I need.