Is there a line of JavaScript that can be used to show/hide (ideally alternately as a toggle) the default toolbar in Adobe Reader -- i.e. the same that happens when you press F8?

I have tried 


from the Adobe JavaScript Reference, but it didn't do anything.

This is probably because the command "ShowHideToolbarBasicTools" is only available "in a privileged context" and not in a per-document script: Adobe JavaScript Reference

Is there maybe a way to have JavaScript send an F8 keystroke?

  • 1
    The docs say (about the white-listed menu actions): "This list applies only to document-level access to menu items. It does not apply to application-level JavaScript or JavaScript from a privileged context" It also says the method will silently fail if {reasons}. I take this to means that the method won't work outside a document context, but it is unclear. Not sure if this is the reason why your call is failing. Page 93 (p. 120 of the pdf)
    – Yorik
    Nov 12, 2021 at 15:47
  • Thanks, I've seen that as well. I believe it's not entirely clear there in the manual. Particularly, it says about the whitelist: "To ensure a secure environment, the menu items that can be executed are limited to the following". And then, "ShowHideToolbarBasicTools" follows in that list. However, the whitelist probably (this is where the manual is not clear) already refers to the commands that are usable "without restriction, in a privileged context", thus the commands available on a per-document level are even more restricted (to the ones that are actually shown when creating a form button).
    – David.P
    Nov 12, 2021 at 16:00
  • You can not edit other peoples gui from a PDF file if you could you would break the security of it all.
    – joojaa
    Nov 12, 2021 at 17:32
  • This is not "editing the GUI" but showhiding entire areas or panes, which is also perfectly possible from the "Initial View" options of the document (i.e. "Hide Toolbars")
    – David.P
    Nov 12, 2021 at 18:29
  • 1
    From what I understand from reading this, it would seem to be related to not having the correct privileges set up to allow it to function. In any case this would seem to be a coding question rather than a graphic design one, and possibly might be better suited to Stack Overflow.
    – Billy Kerr
    Nov 13, 2021 at 12:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.