Copy link to clipboard
Copied
Hi.
I use this script to unhide a template before printing:
this.getTemplate("LIAISON").hidden = false;
this.print({bUI: false, bShrinkToFit: true, nStart: this.numPages-1});
It Works fine in Acrobat Pro but it fails in Reader.
Error message from the JavaScript Console is:
NotAllowedError: Security settings prevent access to this property or method.
Template.hidden:697:Field Bouton 56:Mouse Up
(tested in Reader DC (Mac & Windows), Reader XI (Windows) and Reader 9 (Mac))
But… the JavaScript API reference shows getTemplate as available for Reader, beginning with version 5, there is not any restrictions in the quickbar.
As shown here : Acrobat DC SDK Documentation
Enable menu items JavaScript execution privileges is ticked in Preferences : JavaScript.
Enable global object security policy is unticked in Preferences : JavaScript.
And the document is trusted in Preferences : Security : Enhanced.
So what can I do to unhide this template in Reader ?
Did I mess something?
Copy link to clipboard
Copied
The problem is not with getTemplate, but with the hidden property. It's read-only in Reader.
Copy link to clipboard
Copied
Thank you.
But I don't understand, the hidden property can be used for layers and fields in Reader…
Where can I get info about this hidden property?
Copy link to clipboard
Copied
Templates are not the same thing as fields or layers (OCGs)... You can find out more information about it under the hidden property of the Template object. It's clearly stated there.
Copy link to clipboard
Copied
OK, I found it in the PDF doc. (there are some lacks in the online doc.)
Thank you.
Copy link to clipboard
Copied
I don't see anything wrong with the online documentation. See here:
Acrobat DC SDK Documentation - Template.hidden
It clearly shows the "X" in the last column of the quick bar.
Copy link to clipboard
Copied
Arrgggllll !
I spent so much time to (not) find it.
Thank you too.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now