In my project, I need to prohibit printing to anything other than a physical printer. The output cannot be sent to FAX, Document Writer XPS, or any PDF file writer. Is there any way to determine this by some properties in code and prohibit all destinations that are not actual physical printers? I know I can search for printer names and remove them, but that is obviously not realistic.
My strategy so far is to make my own Printer dialog, which I have working fine so far x-plat, but this problem is not solved.
Yes but as I mentioned, it’s not realistic. That’s way too weak of a barrier, and in many cases would be no barrier at all.
If I had access to a mythical database of all physical printer names, which did not include any Print to Document utilities or FAX machines, then I could check the printer name against this database and remove devices with names not in the database.
Such a database doesn’t exist, right?
Even if it did, checking a name property means any user could just change the name property and bypass the system.
I need a way to access some property or properties of the destination device in code, which the user cannot change, which tells me what this device is: printer, fax, or document file.
Okay. The files are encrypted and cannot be saved to a viewable file, period. They can only be printed to paper. Printing these files to paper is the only purpose of this app, which uses passwords and online database to prohibit access to these files to anyone but licensed users. Each time a user wants to print, they open this app, and the printing action is recorded in the database. Each license gives each user a limited number of printings. If they are able to print to a file, that bypasses the whole system.
The encrypted files also cannot be viewed on the screen, or the user would easily be able to take screenshots and create files from them.
Obviously, the user can scan in a printed document and to make a file from it, but that takes longer, the file is not vector so is obviously scanned, and users are more likely to think twice about doing that.
The security measure is intended to prohibit all of the lazy ways that files could be made from these documents.
That’s a good idea, but unless I have the mythical database, I think it also means the submitted printer would need to be checked manually on reception. This will be a high volume system, so that’s not practical. I really need it all to be automatic.
Is there really no way (on Windows, but possibly also needed on Mac) to find out if the print destination is going to a file?
… I suppose on each print, a notice could say that any electronic file print destination is prohibited, and inform the user that the print destination information is sent to the online database, that violators will be prosecuted with fines and possible imprisonment
can a “PDF printer” be installed on Mac that will appear in the physical printer list? If so then I have the same problem on Mac that I have on Windows.
how can I filter out all non-physical printers on Windows?[/quote]
Devising a software printer is as possible on Mac as it is on Windows. Simply, as it has been built in for quite a while, it is improbable. I could not find any with a quick search on the Internet.
To discriminate virtual and physical printer may simply not be possible. There are many layers in the printing process, and the app is very far from the hardware.
I tried to look at the register, but there is no way to distinguish between virtual, network and physically attached printers. Seems to me you are in to look at the name of the printer, and eliminate any name with PDF and XPS in it for a start.
The list of printer exists in Windows, BTW. You get it when selecting a driver for a new printer which is not recognized right away. Then you get a list of manufacturer and for each a long series of printer names. I got that not long ago when I added a shared printer attached to the Mac on the network.
Ah, I had missed your response earlier. I noticed on that page someone says that the PRINTER_INFO_2 structure will return “FILE” as the Port Name in the structure, but this isn’t true. There may some other clue on that page. Thank you for the link.