Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically disable/enable PDF printing/saving #16

Open
ajmakoni opened this issue Sep 11, 2017 · 1 comment
Open

Dynamically disable/enable PDF printing/saving #16

ajmakoni opened this issue Sep 11, 2017 · 1 comment

Comments

@ajmakoni
Copy link

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?

@ajmakoni
Copy link
Author

ajmakoni commented Sep 12, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant