How to change the spool/direct print setting via code?

China☆狼群 提交于 2019-12-13 05:18:36

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/33347791/how-to-change-the-spool-direct-print-setting-via-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!