如何在 C# 中打印存储在本地硬盘驱动器中的文件? [英] How to print files stored at your local hard drive in C#?
问题描述
我有一个在 C# (WinForms) 中创建的函数,它将文件保存为本地目录中的 gif 图像.如何访问它并将其发送到我的一台网络打印机进行打印?
我现在有这个代码:
internal void PrintLabels(string printerInfo, List shippingLabels){//这是我打印到打印机的地方...foreach(shippingLabels 中的字符串 labelPath){}}
有什么帮助吗?
另一种方法是以编程方式创建 pdf 文档,然后通过命令行批量打印
查看 iText 库.
创建文件后,您可以通过命令行打印它们(您可以使用 System.Diagnostics 命名空间中的 Command 类)
如果您正在批量执行所有这些操作,那么如果您要打印到的打印队列出现问题,您还需要收到通知(可能以编程方式).我相信有一个课程.
有关该主题的更多信息,请尝试此处.>
I have a function created in C# (WinForms) which saves the file as gif image in local directory. How can I access it and send it to printing to one of my network printers?
I have this code here right now:
internal void PrintLabels(string printerInfo, List<string> shippingLabels)
{
//this is where I print to printer...
foreach (string labelPath in shippingLabels)
{
}
}
Any help?
An alternative method would be to programmatically create pdf document/s that you then batch print via CommandLine
Take a look at the iText library.
Once you have created your files, you can print them via a command line (you can using the Command class found in the System.Diagnostics namespace for that)
If you're doing all this from a batch, then you'll want to also be notified (perhaps programmatically) if something goes wrong with the print queue that you are printing to. I believe there is a class for that.
For more information on the subject, try here.
这篇关于如何在 C# 中打印存储在本地硬盘驱动器中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!