Show/hide layers and fields on doc startup
I set up my doc with layers to hide/show all active fields, etc. from anyone not using Adobe Reader DC or Acrobat. I use the script below with .hidden or .visible to control the fields and other script to hide/show text on different layers. I have the script located in a doc level script so that it runs every time the doc is opened. I also have app.runtimeHighlight = true; to highlight the fields automatically.
It works, but when the document is initially opened some of the highlighted fields on the first page do not display at all on the screen while others further down the same page display with no issues. If one scrolls to the very next page and then scrolls back to the first page, all the highlighted fields are then displayed correctly. It seems like a "redraw" or "refresh" type issue, maybe?
Any suggestions?
for (var i = 0; i < numFields; i++) {
var f = getField(getNthFieldName(i));
this.getField(f.name).display = display.hidden;
}
