Disabling any printscreen, screenshot, web capture, or something like that

Which product are you using? PDF.js Express Viewer

PDF.js Express Version “^8.7.1”,

Detailed description of issue
I wanna disable feature like screenshot, or web capture. But it doesnt provide in this site PDFJS Express WebViewer Namespace: UI. I tried with disabling printscreen button with onKeyUp, it works. But user still can use right click, web capture. I search for disaling right click, but the community says that was useless but annoy user.

Expected behaviour
Client hope user cant copy or take any content to the other. Wanna use it for digital library exclusively for the member.

Does your issue happen with every document, or just one?
Happen with every document

Link to document
Sorry we can’t

Code snippet
{Provide a relevant code snippet}
document.addEventListener(“keyup”, function (e) {
var keyCode = e.keyCode ? e.keyCode : e.which;
if (keyCode == 44) {
stopPrntScr();
}
});
function stopPrntScr() {
var inpFld = document.createElement(“input”);
inpFld.setAttribute(“value”, “.”);
inpFld.setAttribute(“width”, “0”);
inpFld.style.height = “0px”;
inpFld.style.width = “0px”;
inpFld.style.border = “0px”;
document.body.appendChild(inpFld);
inpFld.select();
document.execCommand(“copy”);
inpFld.remove(inpFld);
}
function AccessClipboardData() {
try {
window.clipboardData.setData(“text”, “Access Restricted”);
} catch (err) {}
}

setInterval(AccessClipboardData(), 300);

Hello dhiyaulkhaqala,

The browser has many ways to capture the screen, PDFJS Express cannot modify the browser.

The only thing we have control over is printing, which you can disable through:

instance.UI.disableFeatures([instance.UI.Feature.Print])

Best regards,
Tyler

1 Like