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

save pdf with selected layers

New Here ,
Jan 13, 2020 Jan 13, 2020

I have a pdf that has layers. I want to only have one of the layers visible then save so that the print shop can print in large format. When I save with only selected layer visible, the file still has all the layers showing. How do I fix this?

TOPICS
Edit and convert PDFs , Print and prepress
29.4K
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
2 ACCEPTED SOLUTIONS
Community Expert ,
May 29, 2020 May 29, 2020

All layers have a default visibility value. It is these default values that determine the visibility on opening. On the layers panel, right click on a layer and select properties to set this value. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

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 ,
May 21, 2025 May 21, 2025

Set the "initState" property.  However, this only work in Acrobat Pro.   

 

var docOCGs = this.getOCGs();
for (var i=0; i < docOCGs.length; i++)
{
    if (docOCGs[i].name == "Badge Tab")
    {
        docOCGs[i].state = !docOCGs[i].state;
        docOCGs[i].initState = docOCGs[i].state;
    }
}

 

For a strategy that work for Reader you'll need to store the state on the form. For example, in a hidden text field.  Then a document level script can be used to setup the OCG states when the PDF is opened. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

View solution in original post

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
New Here ,
May 21, 2025 May 21, 2025

Hey I'm using buttons to show/hide multiple layers in Acrobat with javascript. How do I save a new PDF with my selection of layers showing? Every time I save a PDF the layers are back to hidden by default. Here's the javascript I use for my button action

 

var docOCGs = this.getOCGs();
for (var i=0; i < docOCGs.length; i++)
{
if (docOCGs[i].name == "Badge Tab")
{
docOCGs[i].state = !docOCGs[i].state;
}
}

 

Appreciate the 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
Community Expert ,
May 21, 2025 May 21, 2025

Set the "initState" property.  However, this only work in Acrobat Pro.   

 

var docOCGs = this.getOCGs();
for (var i=0; i < docOCGs.length; i++)
{
    if (docOCGs[i].name == "Badge Tab")
    {
        docOCGs[i].state = !docOCGs[i].state;
        docOCGs[i].initState = docOCGs[i].state;
    }
}

 

For a strategy that work for Reader you'll need to store the state on the form. For example, in a hidden text field.  Then a document level script can be used to setup the OCG states when the PDF is opened. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
New Here ,
May 22, 2025 May 22, 2025
LATEST

Thank you so much Thom! Works perfectly.

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 Beginner ,
Sep 12, 2022 Sep 12, 2022

Hi, I get annoyed by this also. If you open the pdf in acrobat and deselect the layers you don't want to see, then save as a jpeg it should work and save only the layers you want to see. Then I print that in photoshop.

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 Beginner ,
May 24, 2023 May 24, 2023

I feel like all these answers are wrong or partial. This wokred for me - 1. deselect the layers you want to hide. 2. Right cleck each layer and select properties. 3. for each option turn off all visibilty options and then save as a new file so you dont alter the original. Default State: OFF Initial State: Visibility  - Never Visible, Print: Never Prints, Export: Never Export 

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
New Here ,
Jun 27, 2023 Jun 27, 2023

I made a layer I wanted visible with Acrobat and flattened the layer.  Saved it and open with Photoshop.  Only the layer saved showed up.

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