Copy link to clipboard
Copied
I have created an Interactive PDF in Acrobat from layers exported from Indesign. I have created pop-ups using layer visibility. I have saved the PDF with all layers NOT visible, but when I open the PDF again, random pop-up layers are visible on open. How can I prevent layers that are turned off from becoming visible on open? In other words, they are programmed to turn on with button actions and need to remain turned off until activated.
I have opened the PDF, turned all the layers off and resaved many times, they always come back on when I open the file again.
The visibility of PDF layers (aka OCGs) relies on 2 parameters :
- the "Visibility" which any user can edit by clicking on the eye icon to show/hide any layer or by clicking on a button as in your document. This parameter is never saved and layers reverts to their default state each time the document is closed.
- the "Default State" is the parameter that determines the starting visibility each time the document is opened.
That's the one you have to deal with.
You can also lock layers to pr
...Copy link to clipboard
Copied
Hi,
Are you able to share the document ( or a sample that shows the problem) as it is probably just some of the code running when you are not expecting it too.
Copy link to clipboard
Copied
I have attached a few pages of the document that have layers that have "turned on" after turning them all off and saving. I'm using buttons with "layer visibility" options to hide and show the layers. They all should be hidden until "turned on" by button functions. For some reason, some of them turn themselves on when the file is opened.
Copy link to clipboard
Copied
With a script hide the layers on document open.
Copy link to clipboard
Copied
Don't know how to do that.
Copy link to clipboard
Copied
Hide all layers:
var ocgArray = doc.getOCGs();
for (var i=0; i < ocgArray.length; i++)
ocgArray[i].state = false;
Then show the layer which you want display.
Copy link to clipboard
Copied
Hidding all layers means hidding the "Content" layer too!
In any case, reinventing the wheel with a script is useless, as shown below.
Copy link to clipboard
Copied
The visibility of PDF layers (aka OCGs) relies on 2 parameters :
- the "Visibility" which any user can edit by clicking on the eye icon to show/hide any layer or by clicking on a button as in your document. This parameter is never saved and layers reverts to their default state each time the document is closed.
- the "Default State" is the parameter that determines the starting visibility each time the document is opened.
That's the one you have to deal with.
You can also lock layers to prevent the user from making unwanted manipulations by clicking on the eye icons.
Copy link to clipboard
Copied
That was the ticket!!! Thank you very much, simple and makes so much sense.
Copy link to clipboard
Copied
I wonder if you might help me again. Same kind of Interactive PDF that I am programming with layer visibility. In the preview, when a button is clicked and the next layer becomes visible, there is a box that remains visible where the button was. I cannot figure out how to get rid of this. Once you click somewhere else, it disappears. It happens with all buttons that reveal another layer, the outline of the button remails. See snippit image of what remains from a button clicked. Can you help?