Thursday, September 3, 2015

How to export layers as files in InDesign


I have a one-page document with approximately 150 different layers, each containing an individual set of user credentials. I'm now looking to print 150 copies of this document, one with each set of user credentials on it to send out to 150 different users.


Is there an easy way of automating this process or should I just get started doing 150 manual export operations toggling a new layer each time? The layers are named with the name of the users so there is no numbering or such available for scripting a loop based on layer name. It doesn't matter if I end up with 150 different files or one with 150 pages.



Answer



Try this: in menu window > utility > script In script panel open Application > javascript and right-click on one file (example AddGuides.jsx) and select Show in Finder Duplicate the file in Finder and rename in PagesFromLayers.jsx and now open it with simple text editor. Paste this code:


var myPage;
var myItems;
var myDoc = app.activeDocument;
for (var i=0;i myPage = myDoc.pages.add(); // ...create a page...

myItems = myDoc.layers[i].allPageItems;
for (var k=0;k myItems[k].duplicate(myPage); //...duplicate in the new page!
}
}

Save PagesFromLayers.jsx file and return in InDesign, open the file with multi-layers, double clik on PagesFromLayers.jsx (in script panel) and enjoy ;)


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...