如何使用 C# 更改打印机的端口名称
我已经扫描了,但没有看到这个问题,如果我错过了,很抱歉,这是重复的。
我可以在 PrinterSettings.InstalledPrinters 中找到网络打印机,并从 Printer.Properties 中获取“PortName”属性,但仅设置该属性不起作用。我试图在注册表中暴力更改该打印机端口名,但这也不起作用(尽管我真的不认为它会起作用,但不得不尝试)。
我通过 reg 文件加载实现了新端口,因此不需要构建端口。 (顺便说一句,我知道该端口可以正常工作,因为在打印机属性中设置它效果很好)。
感谢您的帮助。
谢谢
I've scanned SO and didn't see this question posted, sorry if I missed it and this is a repeat.
I can locate the network printer in the PrinterSettings.InstalledPrinters, and fetch the "PortName" property from printer.Properties, but just setting the property doesn't work. I tried to brute force the change for that printer portname in the registry and that didn't work either (although I really didn't think it would but had to try).
I have the new port implemented through a reg file load so don't need to build a port. (BTW I know the port works because setting it in the printer properties works fine).
Your help appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 WMI 设置打印机的端口名称。
这是一个例子:
希望,这有帮助。
You could use WMI to set the PortName for your printer.
Here is an example:
Hope, this helps.