C#如何使用ip地址打印到网络打印机? [英] C# how to print to a network printer using ip address?

查看:819
本文介绍了C#如何使用ip地址打印到网络打印机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用IP地址打印到网络打印机。我可以使用打印机名称来完成它,但对于这个应用程序,我只会在此应用程序投入生产后获取IP地址。我尝试在打印机设置中替换IP地址,但是我收到一个无效的错误。



pd.PrinterSettings.PrinterName = @\\ 10.xx.xx.xx\10.xx.xx.xx;

Trying to print to a network printer using ip address. I can do it using printer name, but for this application I will only be getting the IP address once this app is in production. I tried to substitute the IP address in in printer settings, but I get an error that it is invalid.

pd.PrinterSettings.PrinterName = @"\\10.xx.xx.xx\10.xx.xx.xx";

推荐答案

你不能。必须已经安装了打印机。



在某些系统上,该功能仅供管理员使用,因此您的应用程序不应该创建打印机。毕竟,您还没有适用于所有打印机类型的驱动程序。



您的应用程序只能获取已安装的打印机的名称。您不能仅使用IP地址。
You can't. The printer has to be already installed.

On some systems, that function is reserved for administrators only so you're app should not be creating printers. After all, you don't have the drivers for every printer type either.

Your app can only get the name of a printer to use that is already installed. You cannot use just the IP address.


感谢您的回复,但安装了打印机。只是另一个应用程序正在发送IP地址而不是名称。我只想用ip替换名称,但它返回无效。
Thanks for the reply, but the printer is installed. It is just that another application is sending the ip address and not the name. I just wanted to substitute the ip for the name, but it comes back as invalid.


这篇关于C#如何使用ip地址打印到网络打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆