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

How to set initState for an OCG with javascript?

kilmanjaro
Registered: Mar 13 2009
Posts: 26

I am looking to allow a user (from Reader) to change the initState of a specific OCG by clicking a form button.

I'm searching for a step-by-step method for authoring this into the PDF... anyone know how to do this? I was hoping there was a way of running a javascript action when the button is clicked.

Thanks!

Kevin

My Product Information:
Acrobat Pro 8.0, Macintosh
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi kilmanjaro,

Here is an article from the Learning Center on manipulating OCGs with JavaScript that should be helpful-

http://www.acrobatusers.com/tutorials/2006/create_use_layers

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
kilmanjaro
Registered: Mar 13 2009
Posts: 26
Thanks for getting back to me Dimitri!

I read through the document last week and it was really helpful, but I couldn't make out how to use the initState property correctly...

When I'm authoring the PDF and setting the actions for a Button that when Mouse Up will set the initState for an OCG titled "test" to true.

What is the entire javascript code I would need to paste into the "run a javascript" field?

test.initState. = true;?

Is there any other script that needs to accompany this?

Your thoughts are welcome and appreciated!

Kevin