Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Hide all text layers in document

Contributor ,
Mar 23, 2021 Mar 23, 2021

Is it possible to hide all text layers in a multi-page document (so I can export a copy with only the pictures)?

TOPICS
How to
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 23, 2021 Mar 23, 2021

This would hide all of the text frames in a document:

 

var api=app.activeDocument.allPageItems;  
var i = api.length; while (i--) if (api[i].constructor.name == "TextFrame") api[i].visible = false;

 

This would show them:

var api=app.activeDocument.allPageItems;  
var i = api.length; while (i--) if (api[i].constructor.name == "TextFrame") api[i].visible = true;
Translate
Community Expert ,
Mar 23, 2021 Mar 23, 2021

Yes, of course. Just untick the eye icon in the layers panel. If you want to hide all the layers except one, alt click on the one you want to keep visible.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 23, 2021 Mar 23, 2021

Is it a way to do it at multiple pages as once (I have a 200-page document where I if possible would like to be able to toggle all text on/off with a button)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2021 Mar 23, 2021

Layers are not page related, so you don't have to worry about this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 23, 2021 Mar 23, 2021

Hello,

 

Do you have separate text layers for each page? if so, that's not necessary, I would merge all the text layers into one singe text layer then you would only have one to toggle off when you want to export.

 

Regards,

Mike

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2021 Mar 23, 2021

If you have made a layer in the Layers panel and all of your text frames throughout the document are on that layer, hiding it would hide all of the text frames. It sounds like you want to hide any page item that is a text frame? I think you would need a script for that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2021 Mar 23, 2021

This would hide all of the text frames in a document:

 

var api=app.activeDocument.allPageItems;  
var i = api.length; while (i--) if (api[i].constructor.name == "TextFrame") api[i].visible = false;

 

This would show them:

var api=app.activeDocument.allPageItems;  
var i = api.length; while (i--) if (api[i].constructor.name == "TextFrame") api[i].visible = true;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 23, 2021 Mar 23, 2021

Thanks! I have to figure out how to use scripts (should be possible 🙂 - this will do the trick.

I have also learned that an alternative (or complement) is to put all textframes into a separate layer ("Text"). It is a way to do this as well using a script (so I can fix my files retroactively without having to go thru each single page)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2021 Mar 23, 2021

Here’s the script with a checkbox you can toggle:

 

https://shared-assets.adobe.com/link/db74af04-3e4a-4655-6f06-8071123fe832

 

When you run it you’ll get a checkbox dialog:

 

Screen Shot 23.png

 

If you have anchored objects in the text they will get hidden with the text

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 23, 2021 Mar 23, 2021

Super, many thanks (to all of you) for great help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 23, 2021 Mar 23, 2021

Hello,

 

Re: I have also learned that an alternative (or complement) is to put all textframes into a separate layer ("Text"). It is a way to do this as well using a script (so I can fix my files retroactively without having to go thru each single page)?

 

Give the below script a try. Playing off Robs code, I have it moving all the all textframes into one separate layer "Text" then removeing the empty layers.

 

 

var api=app.activeDocument.allPageItems;  
var i = api.length; while (i--) if (api[i].constructor.name == "TextFrame")
api[i].locked = false;

app.activeDocument.layers.everyItem().locked = false;
    
    for(var i=0;i<api.length;i++){
      try{var myLayer = app.activeDocument.layers.add ({name: "Text"});}catch(e){}         
        api[i].itemLayer =  "Text";

        }
        Array.prototype.filter = function(collection) {  
            var k, i, con, ids = collection.everyItem().id;  
            con: for (k = ids.length - 1; k >=0; k--)     
            for (i = 0; i < this.length; i++)  
            if (this[i].id == ids[k]){  
            ids.splice(k, 1);   
            continue con;  
            }  
            return ids; 
            }  

        var mL = app.activeDocument.pageItems.everyItem().itemLayer,  
        mUnusedLayersID = mL.filter(app.activeDocument.layers),  
        len = mUnusedLayersID.length;  
        while (len-->0)  
        app.activeDocument.layers.itemByID(mUnusedLayersID[len]).remove();

 

 

Rrgards,

Mike

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2021 Mar 23, 2021
LATEST

Hi Mike, I don’t think that will work if a text frame is in a group.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines