views:

518

answers:

2

Is it possible to detect when a user is printing something from their browser?

To complicate matters, if we are presenting a user with a PDF document in a new window is it possible to detect the printing of that document ( assuming the user prints it from the browser window)?

The closest I've been able to find is if we implement custom print functionality (something like this) and track when that is invoked

I'm primarily interested in a solution that works for internet explorer (6 or later)

+1  A: 

Simple answer: No.

For IE maybe it is possible to write custom ActiveX application that can monitor everything you want, but this will not work for pdf's or other non-html content.

Andrejs Cainikovs
yeah, I'm pretty sure that this would be the case, I'll leave this open a while longer just in case someone else knows something we don't.
TygerKrash
A: 

In Arcobat, the WillPrint event will fire before the printing starts. If you're doing it from Adobe Acrobat, from the menus chose Advanced ... Document Processing ... Set Document Actions ... Select "Document will Print" option ... edit and then you can write the javascript function you desire. The printing will continue, but this would be the place you'd insert watermarks. If you are looking to prevent printing, you need to set the document security appropriately. If you are looking to stop printing an incompletely filled out form, you need to use XFA (drawbacks of this approach are that viewers are required to have Acrobat 9+ and you'll need LiveCycle to create the forms.)

javascript references for Acrobat

some notes on difference between AcroForms and XFA

Tangurena
That's all pretty useful, unfortunately I'm pretty sure we're not going to be able to use that since we're generating our documents dynamically. Also I'd need to be able to connect to our web app and let it know that the printing has occurred, not sure that'd possible in this solution.
TygerKrash
It is possible for the document to hit a web service (message: "hey! I printed!"), but the default acrobat settings will be to require the user to manually allow it. It is possible to make (and require) the users to have an Acrobat add-in that can control this, or handle what you want; however, Adobe will take the position that this add-in incorporates DRM and thus they'll want $50k/year licensing for the add-in. Otherwise the license key for an add-in is $1k or 2.5k/year. Add-ins require a "reader integration key" to be able to run in the (free) Adobe Reader.
Tangurena