Redraw PDF after OCG initial state changed via Javascript
I've successfully create a javasript (see below) to set specified layer's initial states to OFF, which works great except I have to close and reopen the file to confirm. Setting the State (visible or not visible) doesn't seem to work when the script is run.
I'd like to essentialy redraw the document with the changed intial states as set, similar to if I'd done this via a Droplet which automatically behaves like the document saves, closes, and reopens.
Is there a javascript command that will do this?
My current script (segment) is shown below.
function setLayerVisProperty(){
var ocgArray = this.getOCGs();
for (var i = 0; i < ocgArray.length; i++){
if (ocgArray[i].name.match (/imprint|inkjet/i)) { //if named contains...
//ocgArray[i].State = false; //then make not-visible. Currently off until learn how to force save & redraw.
ocgArray[i].initState = false //then initial state to not-visible
}
checkPoint = "After"
msg = ("ocgArray[" + i + "] " + ocgArray[i].name + " | " + ocgArray[i].state + " " + ocgArray[i].initState)
report(checkPoint, msg);
}
}
Thanks!
