Disable print option using JavaScript

Disable print option in browser using JavaScript. The alert() method displays an alert box with a specified message (Sorry, you are not authorized to take a Print).

To disable print option use following below code:-

    $(document).on('keydown', function(e) {
        if(e.ctrlKey && (e.key == "p" || e.charCode == 16 || e.charCode == 112 || e.keyCode == 80) ){
            alert("Sorry, you are not authorized to take a Print");
            e.cancelBubble = true;

Disable print option pdf using JavaScript

You can customize this code further as per your requirement.