Answered
Hi,
I'm wondering if there would be a way to lock a layer automatically (with a custom button for example)?
Usually, I need to select the layer, right-click on "properties" and click on "Locked" in the Default State line. It's a bit long since I'm doing that repetitively.
Thanks,
Bruno
For example here's a script that finds a layer called "skyline" and locks it - you could run the script from a menu item, but you'll need to pass it a reference to the current document in the cDoc variable:
var ocgArray = cDoc.getOCGs();
for (var i=0; i < ocgArray.length; i++) {
if (ocgArray[i].name == "skyline") ocgArray[i].locked = true;
}
To run it on the debug console, change "cDoc" to "this". Read the Acrobat SDK documentation if you need to know about adding menu items or tool buttons.