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

javascripts layers?

pessi
Registered: Mar 10 2010
Posts: 11
Answered

Dear All,
 
I had a look at a sample file of "Document License Dialog" at AcroDialogs.
 
http://www.windjack.com/product/acrodialogs/
 
I would like to implement something similar, which I did by adding a layer on top of the page. However, when the file is opened in acrobat reader, you can see the layers and hide it, which kind of defeats the purpose. However, the layers are not visible for the acrodialogs example file.
 
How did they implement it?
 
Thank you in advance, for all your ideas.
 
Cheers,
Prasad.
 

My Product Information:
Acrobat Standard 9.0, Windows
UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
Accepted Answer
The AcroDialogs example uses a dialog window, of course, rather than a PDF layer.

You can remove layers from the listing on the sidebar by pointing doc.setOCGOrder to a null array in JavaScript. It will still be addressable by scripting but won't show on the UI.
pessi
Registered: Mar 10 2010
Posts: 11
Thank you for your answer.

I still donot get the logic of having different content on top without using layers.

I understand that the dialog window is popped up immediately and depending on the yes/no the
content is changed. How did they achieve this without layers?

Thanks for the setOCGorder tip. Will try that.

Prasad.
pessi
Registered: Mar 10 2010
Posts: 11
I added the following javascript but still can see the layers.
Can you help?

if (retn == "ok")
{
var nullArray = new Array();
nullArray = null;
this.setOCGOrder(nullArray);
}
Any ideas?

Thanks in advance,


Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi pessi,

This article on OCGs (layers)in the Learning Center here should be helpful-
http://acrobatusers.com/tutorials/2006/create_use_layers

It is a bit dated but the info is still all valid.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com



pessi
Registered: Mar 10 2010
Posts: 11
Thank you all. It worked.