Skip to content

I could not find a way to determine if the user clicked the "Print" or "Cancel" button #712

Description

@RobinrajM

PrintJS Printing is working fine, but I could not find a way to determine if the user clicked the Print or Cancel button. Please help me to get it resolve this issue. I dont want to do any stuff if cancel button clicked in print dialog box of printJS

I tried to print Base64 pdf file using PrintJS library, it opens print dialog box with print and cancel option. If I clicks on print pdf getting printed and if I clicks on cancel it is not printing. This logic working fine.

But if successful printing I want to do some logic not for cancelled pdfs.

Here how can I identify whether print button clicked or cancel button clicked? in the printJS library.

can anyone help me to get it complete.

Example:

printJS({
printable: data,
type: 'pdf',
base64: true,
onPrintDialogClose: function (event) {
if (event === true) {
alert('Print button clicked');
} else {
alert('Cancel button clicked');
}
}
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions