electron-pdf-window
electron-pdf-window copied to clipboard
Dynamically disable/enable PDF printing/saving
Hello, I have tested your module and it works perfectly! However, is there away in which I could dynamically enable/disable print/saving option on the window?
Hello, I took sometime in the evening and have figure a solution. Any one interested in this features, the easiest solution is to insert CSS in your DOM:
win.webContents.on('dom-ready', () => {
win.webContents.insertCSS('.toolbarButton#print,.toolbarButton#viewBookmark,
.toolbarButton#download,.toolbarButton#openFile,
.toolbarButton#viewAttachments{display: none;}');
});
You can then dynamically show each component by inserting another CSS in the DOM but this time it must say {display: block}
(can be block, initial, inline e.t.c)
The CSS class is as follows:
.toolbarButton#openFile = Open File Button, .toolbarButton#viewAttachments = View Attachements button e.t.c
To see more classes, check out the view.html page here: PDFJS-viewer
Hope this helps someone