We have an existing cross-platform (Mac, Windows, Linux) application written in Java, that programmatically sends a document to the default printer without showing a print dialog.
Across different platforms it is possible to set up a printer to print to file. For example in Windows it is possible to set the XPS Document Writer as the default printer, or to change the properties on a printer such that it keeps a file copy of all documents.
Is it possible to detect this? I'm open to any suggestions, but the solution must work cross-platform. I am assuming that such details are too low level (and platform dependent) so a Java solution is probably not feasible, but would be ideal if possible.
We're not necessarily looking for a bullet-proof solution, so any suggestions would be helpful, no matter how wacky!
Edit:
I realise there's a whole host of non-technical issues here, which could provoke a lot of discussion (who'd have thought it?). I want to make it clear that I am not a fan of DRM (as this has been likened to) and not trying to be evil :).
I appreciate that these issues are real, and when making my recommendations I will make this very clear. However I do have to investigate the technical solution before I can do this.
From the printing dialog of Chrome click the Change button and change from Save as PDF to your printer, then it should print instead of saving the file.
No.
You could do all kinds of weird OS-dependent detection (is it using somedriver.dll
?), or name-sniffing ("does it contain 'XPS'?") but in the end:
\\joescomputer\someprinter
? Hard to tell: could be a printer, could be a PDF generator, could be aunt Matilda; network adds another layer of abstraction between your program and the physical hardware)You are essentially fighting a DRM battle in a slightly different setting (this is not a moral judgement, but a statement of fact: "I want to limit the choices that users of my software have" is the core of DRM, and of your question - regardless of any opinion I may have on the subject); as you may be aware, those are messy and have unpleasant side effects ("what do you mean, I can't print on my physical printer because it's named WinXPStation?!?" "my antivirus says that your software is trying to mess with my printing drivers, are you pushing spyware?!?"), and they are unwinnable - there's always a workaround.
Don't even think of actually disabling something you may think is a print-to-file driver: note Sony's DRM fiasco, and note that you might get sued for illegally tampering with the computer.
On a more pragmatic note, if your software disables some other part of the system, and then that other part doesn't work because it's disabled, word will get out. "I installed SomeSoftware by NigelSoft, and it broke my printer" is not a good reputation to acquire, and hard to erase - people will complain, and, well, whatever goes on the Internet might remain there forever (note the various similar incidents you'll discover by searching for "(antivirus vendor) breaks Windows"). Note also that the vendor in question will be less than happy: "your #@$@ software is wilfully breaking my Wonderful Special Rainbow Printer (tm), you owe us the money we had to refund, aaand here's a couple of lawsuits against you".
In other words, I feel there is some non-technical requirement behind this, which - unfortunately - is not solvable purely by technical means (and definitely not with the deep abstractions of Java). You may need to go the legal route, such as including a "you are not allowed to save the printouts electronically" and showing this in huge red blinking letters at every point where printing is requested. This will be similarly ineffective as the technical solution, but may be enough to CYA (as you'll be clearly shifting the decision to the user).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With