We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Intercept PRINT action (CTRL + P) to replace it by our own logic

Is there a way to intercept actions on KEYDOWN (CTRL + P in particular, but also CTRL + S) to replace them with our own logic. For example, we would like to be able to show a PDF created by us when the user uses CTRL + P or resquests the printing of the data grid.

Best regards

1 Reply

MS Monisha Saravanan Syncfusion Team December 12, 2022 01:22 PM UTC

Hi Fredreic,

Greetings from Syncfusion support.

We suggest you to use the below Javascript code to prevent the print action and after that you can customize the solution as per your requirement either in Javascript code or by using event callback function. Kindly check the attached code snippet and sample for your reference.

window.addEventListener('keydown', function (event) {

    if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {


        if (event.stopImmediatePropagation) {


        } else {



        this.alert("Now display the pdf")





}, true);


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SampleC-785835788-1375959088.zip

Please let us know if you have any concerns.



Live Chat Icon For mobile
Up arrow icon