GithubHelp home page GithubHelp logo

How to disabled Ctrl+P and Ctrl+S?. Right now anyone can print or download using keys. Please help me on this. about ng2-pdfjs-viewer HOT 3 CLOSED

intbot avatar intbot commented on August 23, 2024
How to disabled Ctrl+P and Ctrl+S?. Right now anyone can print or download using keys. Please help me on this.

from ng2-pdfjs-viewer.

Comments (3)

codehippie1 avatar codehippie1 commented on August 23, 2024

Please have a look inside viewer.js shipped with this package. You may be able to do this there.

I am currently off the grid with limitted network access.

from ng2-pdfjs-viewer.

codehippie1 avatar codehippie1 commented on August 23, 2024

@KanhaKanha123 Presently, this may not be supported in PDFJS.

Please see mozilla/pdf.js#5930 . You may directly follow up there.

Closing this issue as it is out of scope

from ng2-pdfjs-viewer.

Milun avatar Milun commented on August 23, 2024

If anyone else comes across this issue, in viewer.js, there's a supportsPrinting() function.
If you hardcode it to always return false, you'll disable "Ctrl + P".

Likewise, in the downloadOrSave() function, just put a return; at the beginning. This will will disable "Ctrl + S".

EDIT: Also, put a return; at the start of the window.print function in viewer.js as well to stifle the console error.

Note: even with these changes, someone can still use web inspector to find the .pdf being loaded and download it from there. This just hinders people a little.

from ng2-pdfjs-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.