user4621642
user4621642

Reputation:

Detect if the Printer Had Successfully Print the Page

I was printing my site page using the code below:

window.print();

How will I know if the page was successfully/not successfuly printed by the printer? The reason why I want to do this is "to avoid reprinting the page twice". Each successful print is quite expensive in my case because I am printing an ID.

I am looking for all browser compatible solution. Thank You.

Upvotes: 2

Views: 950

Answers (2)

EugenSunic
EugenSunic

Reputation: 13703

There is no event which is available to track anything that has happened in the print dialog.

However there are events

  • onbeforeprint which is fired before the dialog actually appears
  • onafterprint is fired just before dialog appears but it is extremely hard to know whether the page actually printed

Both of them only work in firefox+6 I believe and higher versions of IE

Upvotes: 0

Tigran
Tigran

Reputation: 3585

Can't do that :/

There is window.onafterprint handler, but it is fired both when the user prints or aborts a print dialog. And it is not widely implemented too.

P. S. I don't see why you would want to know whether a print took place or not.

Upvotes: 1

Related Questions