1

I have project that require save something to database after click print button on browser print dialog (window.print).

I have try onafterprint based on How to detect window.print() finish but when i click cancel or close it still save to database.

any idea how to save to database only on click print button ?

  • There isn't any way to do this. – yaakov May 18 '22 at 04:32
  • The `window.print()` method launches the print preview window which will not inform back whether the print was successful or cancelled. So you cannot do that. – BadPiggie May 18 '22 at 04:40
  • Looks like neither `beforeprint` nor `afterprint` tells you whether the user printed, cancelled or if the print was unsuccessful. You will have to find a workaround. – cSharp May 18 '22 at 04:46

0 Answers0