如何使用IP地址打印到网络打印机



我已经完成了一个使用打印机的应用程序。

这是打印代码:

this.printDocument1 = new System.Drawing.Printing.PrintDocument();
this.printDialog1 = new System.Windows.Forms.PrintDialog();
printDocument1.PrintPage += printDocument1_PrintPage;
this.printDocument1.Print();

现在我有一台名为XXX的打印机,它的IP地址是192.168.2.200

我的问题

请问我怎样才能用那台打印机打印?

感谢

更新

this.printDocument1 = new System.Drawing.Printing.PrintDocument();
            this.printDocument1.PrinterSettings.PrinterName = "MainPass";
            this.printDialog1 = new System.Windows.Forms.PrintDialog();
            printDocument1.PrintPage += printDocument1_PrintPage;
                this.printDocument1.Print();

则CCD_ 1为

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.DrawString("PANTRY KOY", valueFont, Brushes.Black, width, height);

            printDialog1.Document = printDocument1;
}

如果您有一个PrintDialog实例,这意味着您允许用户选择打印机,并且您需要尊重在那里选择的打印机。(提示:您可以通过对话框的PrintSettings属性的PrinterName属性设置对话框中显示的初始打印机)。在那之后,我敢打赌,如果你扫描文档中的PrintDocument属性,你会看到你需要做什么来设置打印机(提示:IP地址不重要,但PrinterName重要)。

最新更新