Question

Is there a way to programmatically configure a printer that prints to a file (local file port) to bypass the spooler service and send the data directly to the file ?

I have looked @ prnadmin.dll (nothing relevant there) and WMI (nothing relevant). Any ideas ? And no, I don't want to stop the print spooler service in Windows (XP SP3), just make the printer bypass it.

Was it helpful?

Solution

The PRINTER_INFO_2 structure has a parameter called PRINTER_ATTRIBUTE_DIRECT. You can get the handle to the printer using OpenPrinter, get this structure, change the attribute (make sure you bitwise AND it so that you dont change any of the other existing attributes) and then do a SetPrinter with this modified structure.

Refer to this link to see how you can use SetPrinter. http://support.microsoft.com/kb/140285

Hope this helps. If so, please vote a +1 for the answer :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top