It's an O.S. function, as well as a page function, and a print function so there are a few things you need to do - The steps below are specific for windows, however can be implemented in any O.S. with the same concept -
- Disable the print screen at an O.S. Level
Here are the steps of disable Print Screen key:
1.Copy the following registry to notepad and saved as a .reg file.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,04,00,00,00,00,00,2a,e0,00,00,37,e0,\
00,00,54,00,00,00,00,00
2.Apply the registry
3.Sign out and sign in again.
Then you need to block the browsers capability of capturing screens in the cases where chrome or edge or firefox have extensions that enhance print screens -
And for extra measure, disable right click (I put it on document but you can put it per DOM
document.addEventListener('contextmenu',
event => event.preventDefault());
window.addEventListener("keyup",kPress,false);
function kPress(e)
{
var c=e.keyCode||e.charCode;
if (c==44) event.preventDefault();
}
Then as an extra, to disable printing and items, you need to mark the print media as display none
@media print {
.noprint {
visibility: hidden;
}
}
And if you want to be POPIA/GDPR compliant, you have to disable things like pdf download, object references and things so as a bonus item, Use PDF.js to render the pdf as html with full control over the rendering of the PDF, download and printing using the above
This reference allows password entries and successfully gave us full control over all features for capturing or saving information from protected sites
https://usefulangle.com/post/22/pdfjs-tutorial-2-viewing-a-password-protected-pdf