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.

  • 3
    This is called 'mail merge'. I'd suggest googling 'Indesign Mail Merge'
    – DA01
    Aug 20, 2013 at 20:30
  • Thank you, an excellent suggestion. Unfortunately I was only provided with an indesign file with 150 layers and no separate data source so this doesn't seem to be an option for me.
    – oskare
    Aug 20, 2013 at 20:38
  • Oh! Gotcha. That sounds like...a huge headache. Sorry! Hopefully someone might have a way to help with that.
    – DA01
    Aug 20, 2013 at 20:46

1 Answer 1


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 ;)

  • This solution make a doc with a number of pages like number of layers + 1, in the first page you have the same situation of the start. Ask if you want a different solution (a multiple files or different file with multiple pages...)
    – steguozzo
    Sep 24, 2013 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.