Yunus Emre Arslan
Yunus Emre Arslan

Reputation: 13

Identifying Clicked Button in Preview Modal When Performing Print Operation with react-to-print

I want to perform a print operation using react-to-print and I want to know which button (print or cancel) is clicked in the opened preview modal for this operation. How can I do that?

I tried using the beforeprint and afterprint methods, but they don't work for my purpose.

Upvotes: 0

Views: 181

Answers (1)

Matthew Herbst
Matthew Herbst

Reputation: 32043

Unfortunately this is not supported by browsers at this time, so react-to-print is not capable of providing this functionality.

From MDN:

The afterprint event is fired after the associated document has started printing or the print preview has been closed.

The whatwg spec defining the event also does not provide a mechanism for knowing

Related SO question: ONAFTERPRINT event fires on the wrong button

Upvotes: 0

Related Questions