Hide all text layers in document

Explorer ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Views

109

Likes

translate

Translate

Translate

Report

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

Adobe Community Professional , 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;

Likes

translate

Translate

Translate
Adobe Community Professional ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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.

Likes

translate

Translate

Translate

Report

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
Explorer ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Enthusiast ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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.

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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;

Likes

translate

Translate

Translate

Report

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
Explorer ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Explorer ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Enthusiast ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Mar 23, 2021 Mar 23, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

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