crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.28k stars 672 forks source link

onPrintDialogClose - cancel or print button clicked? #617

Open amilo2003 opened 2 years ago

amilo2003 commented 2 years ago

The onPrintDialogClose event works well, but I could not find a way to determine if the user clicked the "Print" or "Cancel" button. Can you please add the actual button clicked as parameter in the callback function?

Example: printJS({ printable: data.report, type: 'pdf', base64: true, onPrintDialogClose: function (e) { if (e === true) { alert('Printing done - Print clicked'); } else { alert('Cancel button clicked'); } } });

daphnesmit commented 2 years ago

This library is not maintained. https://github.com/daphnesmit/prntr I have a typescript library which does the same as print-js

amilo2003 commented 2 years ago

Thanks, I can use that, but does it provide on print dialog ose buttons? Or is it the same methods/events as print.js?


From: Daphne @.> Sent: Saturday, January 22, 2022 5:32:10 PM To: crabbly/Print.js @.> Cc: amilo2003 @.>; Author @.> Subject: Re: [crabbly/Print.js] onPrintDialogClose - cancel or print button clicked? (Issue #617)

This library is not maintained. https://github.com/daphnesmit/prntr I have a typescript library which does the same as print-js

— Reply to this email directly, view it on GitHubhttps://github.com/crabbly/Print.js/issues/617#issuecomment-1019292794, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFOZI6DQA6VV5LOPMUEK3MLUXLEXVANCNFSM5L6NJTLA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

liujianlou commented 2 years ago

Have you solved it?

lucasctd commented 9 months ago

Does not seem to be working anymore. The event is being fired when the dialog opens xD (MS Edge 120.0.2210.61). I need to fire run a code after the user has printed the document :v

Pirulax commented 5 months ago

Yeah I noticed the same. At least printing still works as expected.