打印使用IP地址的网络打印机 [英] Print to a network printer using IP address

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

问题描述

我想在一个文件名和一个打印机的IP地址发送到指定打印到的打印机。

I want to send in a filename and a printer's IP address to specify which printer to print to.

我收到一个错误说设置访问打印机xxx.xxx.xxx.xxx'是无效的。当我到达printdoc.Print()。

I am getting an error saying "Settings to access printer 'xxx.xxx.xxx.xxx' are not valid." when I get to printdoc.Print().

我如何设置基于IP地址打印到的打印机?

How to I set which printer to print to based on the IP Address?

    printdoc = new PrintDocument();
    printdoc.PrinterSettings.PrinterName = IPAddress.Trim;
    printdoc.DocumentName = FileName;
    printdoc.Print();

如何解决这个问题呢?它的C#VS2010独立的Windows应用程序

How to solve this issue?Its a c# vs2010 standalone windows application

推荐答案

是网络为你运行你的软件的计算机打印机访问?

Is your printer accessible in network for the machine you're running your software on?

<一个href="http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.printername.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.printername.aspx

正如你所看到的,你应该叫的IsValid 来确定是否一切正常,你也可以使用 InstalledPrinters 属性来获取系统上安装的打印机的列表。我猜你没有正确安装打印机,或者您没有足够的权限,或者类似的东西。

As you can see, you should call IsValid to determine if everything is ok and you can also use InstalledPrinters property to get a list of printers installed on the system. I guess you don't have installed the printer correctly or you don't have sufficient permissions or something like that.

编辑::如果使用名称的作品,这应该做的伎俩:<一href="http://stackoverflow.com/questions/4629867/how-to-access-a-printer-name-from-ip-on-network-in-c">How和网络上的IP访问C#中的打印机名称?

edit: if using name works, this should do the trick: How to access a printer name from IP on network in C#?

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

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