How to change initial state of layers to show and hide them in the pdf?

62 views
Skip to first unread message

Ryan

unread,
Feb 24, 2015, 3:12:36 PM2/24/15
to pdfne...@googlegroups.com
Q:
What I want to do is set the layers visible to false or true from the java code and re-save the new document .

Do you have a sample code to set the existing layers in PDF to visible true or false .

A:
In this case you want to call the following code.

Config init_cfg = doc.getOCGConfig();
/**/
for (i=0; i<sz; ++i)
{
 
Group ocg = new Group(ocgs.getAt(i));
  ocg.setInitialState(init_cfg, false); // Will be off (not visible) NEXT time document is opened.
}
doc
.save(...);


Reply all
Reply to author
Forward
0 new messages