enter image description here

Can I merge layers of same name in any auto script instead of selecting & merging one by one in pdf.

  • 1
    Yes, you can probably write a script to merge layers with the same name.
    – Luciano
    May 30, 2018 at 13:54

1 Answer 1


In this kind of problem, I would rather use prefix before each name. In example:

PREFIX_Folio Footer Slug.
PREFIX 2_Photo_Credits

Then, we could use an ExtendScript to make something like this:

var selectArr = [];
var test;
var layerName;

var layerArr = docRef.layers.everyItem().name;
var docRef = app.documents[0];

for (i = 0; i < layerArr.length; i++) {
test = layerArr[i].substr(0,5);

if (test == "PREFIX") {
     layerName = layerArr[i];

var mergeLayer = selectArr.shift();

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.