I use pdfview to show a print preview to user. PdfView has a print button for sending the content to a printer. It works fine. Now I need to run some code before printing, and some other code after.
Is it possible to implement 2 events: BeforePrinting and AfterPrinting for the PdfView?
If not, is there any other way to get the desired result?
Very hard if not impossible. The pdf viewer used depends on the browser. With Wisej you can select either the native viewer, google docs, mozilla pdf.js or your own viewer. You could clone the pdf.js viewer to your server and see if you can hook up an event in the source code.
The problem is that even this technique doesn’t work, it fores both events immediately and only when printing the page. If you print the pdf viewer it doesn’t since the viewer is an embedded object with a different dom.