如何在C#中打印到多台打印机 [英] How to print to multiple printers in C#
问题描述
大家好,
我有两台本地连接的打印机(热敏打印机)和其他连接到网络的打印机。我的设备和打印机部分都显示了打印机。但我的问题是我只通过默认打印机进行打印。
请帮我解决这个问题。
我尝试过:
public static Void Print(字符串文件,字符串打印机)
{
试试
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = true;
psi.Verb =print;
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.Arguments = printer;
psi.FileName = file;
进程s.Start(PSI);
}
catch(exception ex)
{
ErrorLog.WriteErrorLog(ex.ToString());
}
}
Hi all,
I have two printers one locally connected(thermal printer) and other connected to network.Both Printers are shown in my devices and printers section.But My problem is that i am getting print through default printer only.
Please help me on this issue.
What I have tried:
public static Void Print(string file, string printer)
{
try
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = true;
psi.Verb = "print";
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.Arguments = printer;
psi.FileName = file;
Process.Start(psi);
}
catch (Exception ex)
{
ErrorLog.WriteErrorLog(ex.ToString());
}
}
推荐答案
谷歌搜索出现了这个:StackOverflow:http://stackoverflow.com/questions/15612370/printing-to-non-default-printer-from -c-sharp [ ^ ]和 StackOverflow:如何获取计算机中所有打印机的列表 [ ^ ]
Google Search turned up this: StackOverflow: http://stackoverflow.com/questions/15612370/printing-to-non-default-printer-from-c-sharp[^] and StackOverflow: How to get the list of all printers in computer[^]
这篇关于如何在C#中打印到多台打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!