Prevent Display of Bookmark Button?

65 views
Skip to first unread message

s.crandall

unread,
Apr 21, 2016, 5:23:52 PM4/21/16
to PDFTron WebViewer
What jquery code can I use to hide the Bookmark Button?  Do I include the code in defaultScriptExtension.js ?  or in ReaderControl.js?  

The bookmark button also needs to be hidden in Mobile View.

Thank you!

Anatoly Kudrevatukh

unread,
Apr 21, 2016, 5:48:00 PM4/21/16
to PDFTron WebViewer
The recommended place for WebViewer modifications is config.js. You can read more on this here: https://www.pdftron.com/webviewer/demo/tutorials/getting-started-config-files.html

s.crandall

unread,
Apr 25, 2016, 1:45:41 PM4/25/16
to PDFTron WebViewer
I have read through this document and I understand now to use a config.js file.  What method I should use to hide the Bookmark button?  I've looked through all of the API Reference documents and I can't identify the correct method to use. Please advise, thank you!  -Suzanne

Anatoly Kudrevatukh

unread,
Apr 25, 2016, 4:28:48 PM4/25/16
to PDFTron WebViewer
As explained in "Modifying the UI" section, "By the time the config file is executed the DOM will have been loaded so you can safely access elements immediately". That means jQuery can be used to access the DOM element of the Bookmark button and hide it.

To identify id of an element on a page you could use Chrome Developer Tools. Right click on the Bookmarks button and choose "Inspect". It will highlight the element in DOM. 

So from the previous step you can see that the parent container of the button can be accessed like this $('#tabMenu'). Through the parent you can access it's children and .hide() any buttons that don't need to be displayed.

Documentation on jQuery selectors can be found here: https://learn.jquery.com/using-jquery-core/selecting-elements/

s.crandall

unread,
Apr 26, 2016, 12:23:24 PM4/26/16
to PDFTron WebViewer
Thank you for your detailed response.  I appreciate it!   -Suzanne
Reply all
Reply to author
Forward
0 new messages