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 print if cancel button clicked 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');
}
}
});