0

I need to change the setting in the print properties that specifies either: 1. "Spool print documents..." or 2. "Print directly to the printer."

In this answer J... indicates that this can be done using the PrintQueue Class. How?

MSDN PrintQueue.isDirect (ReadOnly Property) says this: "This property can be set only through the Windows common print dialog."

I assume that applies specifically to .net and may not be true in the absolute sense. So how to change the spool/print direct setting via code?

Community
  • 1
  • 1
D_Bester
  • 5,723
  • 5
  • 35
  • 77
  • That was an error in my previous post - I've corrected it. You cannot change the print mode (spool/direct) using that class. You may be able to do it using native WinAPI calls, probably in an elevated application only, I'm not sure. It's probably not something your application should be doing, however. This is a system-wide setting and it will cause all applications to lose print spool functionality - this is something that would seriously irritate users who make any use of printing. If you need to ensure serialization of printed documents it's best to manage this yourself. – J... Oct 26 '15 at 16:05
  • @J... OK not surprised. This is for a one-off application used in a dedicated computer not used for other purposes. So system-wide is no problem and irritating users is not a problem either. Of course I am pursuing other options simultaneously, but if I had this capability it would be seriously helpful. – D_Bester Oct 26 '15 at 22:57
  • 1
    Well, there's always... http://www.undocprint.org/winspool/registry You'll need administrator rights to modify the registry key in question, of course, but this would be one way to do it. – J... Oct 26 '15 at 23:11
  • Great! I'd say this qualifies as an answer. – D_Bester Oct 26 '15 at 23:16

1 Answers1

0

From comment of J...

Quoting from: Windows Spooler Registry

Various printer options can be set via the windows registry. Each installed printer has a subkey in the following Registry path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\

Under this there is a attributes bitmap, in the value Attributes : REG_DWORD 0002 (0x0002) Direct: Document to be sent directly to the printer.

The spooler service might need to be restarted, for the changes to take effect.

Note that this registry value contains multiple attributes. See Windows Spooler Registry for more details.

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. Modify the registry at your own risk.

D_Bester
  • 5,723
  • 5
  • 35
  • 77