Want to add blur on Pdf when a user tabbed out of application

Hello!

Im currently trying to implement a blurr effect on my pdf when a user is tabbed out of the application to prevent snippingtools to capute the content.

didn't find a similar post so im trying to ask the question here insted

i've followed some guides ive found but are unable to make it work.

Anyone have any idea how to implement a blurr effect on pdf whne a user is tabbed out of the application so snippingtool and similar devices are unable to work?


1 Reply

CK Chinnamunia Karthik Chinna Thambi Syncfusion Team June 12, 2024 11:51 AM UTC

Hi Oskar,

Please find the code snippet and sample to blur the PDF Viewer when you click outside of the PDF Viewer.


Code snippet:


 

React.useEffect(() => {

    document.addEventListener('click', function (args) {

      var pdfViewerDiv = document.getElementById('container');

      if (pdfViewerDiv.contains(args.target)) {

        pdfViewerDiv.style.filter = 'none';

      } else {

        pdfViewerDiv.style.filter = 'blur(5px)';

      }

    });

}, []);


Sample: https://stackblitz.com/edit/react-yag7bp?file=index.js


In the provided sample, when you click outside the PDF Viewer, the PDF Viewer blurs, and when you click inside the PDF Viewer, the PDF Viewer won't be blurred.


Kindly try this and If there's any misunderstanding regarding your requirement, or if your needs differ, please provide more details such as a video recording or screenshots. This will help us accurately identify your requirements and provide a suitable solution.


Loader.
Up arrow icon