These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Howto show several layers on a page one after one by push a button?

peetu
Registered: Dec 21 2009
Posts: 3
Answered

Hi
I haven't found a solution by googling so decided to ask here.
I have a pdf with a few layers (initstate=false) made from InDesign.
Actually it is a workbook with answers on layers that should be shown clicking a button.

I've found a script snippet which toggles all layers on in the open page by clicking a button.
Script below:
var docOCGs = this.getOCGs(this.pageNum);
for (var x=0; x < docOCGs.length; x++)
{

docOCGs[x].state = !docOCGs[x].state;
}

But, what I want is to toggle one layer on when clicking a button and a second layer on clicking a button etc.
Now, I don't know how to edit that script to act as needed.
Is it possible at all? Must I do button for every question on a page to show answer(layer) for that?
Tried that already (buttons), but a clickable javascript button (like page navigation buttons) could be copied to whole document.
Any ideas anybody?

peetu
Registered: Dec 21 2009
Posts: 3
Hi again.
Problem solved. Found an answer in Acrobat 9.1 SDK javascripts.
Short and neat.