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.

8/20/2013 8:46:00 PM

Accepted 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<myDoc.layers.length;i++){ // for each layers...
    myPage = myDoc.pages.add(); // ...create a page...
    myItems = myDoc.layers[i].allPageItems;
    for (var k=0;k<myItems.length;k++){ //...and for each objects in layer...
        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 ;)

11/11/2015 9:26:00 AM