如何在 C# 中打印存储在本地硬盘驱动器中的文件? [英] How to print files stored at your local hard drive in C#?

查看:41
本文介绍了如何在 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屋!

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