如何将字节数组直接打印到网络打印机 [英] How to print a byte array directly to a network printer
问题描述
亲爱的所有人,
我在C#中遇到问题,我想直接将字节数组打印到打印机。意味着打印一个文件我要打印一个字节数组。我已经找到了一个解决方案 http://support.microsoft.com/kb/322091 [ ^ ]但没有得到任何帮助。
随着这个代码的帮助我可以发送字节到打印机,但打印机给我错误,因为文件无法打印。
提前谢谢。
$ / b
$ P $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ >
以图形模式打印字符串,这将为您提供有保证的通用打印机独立解决方案。所有你需要它来使用类 System.Drawing.Printing.PrintDocument
:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx [< a href =http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspxtarget =_ blanktitle =New Window> ^ ]。
您将在本文中找到一个简单的代码示例。
Dear All,
I am stuck in a problem in C# where I want to print a byte array directly to a printer. Means instated of print a file I want to print a byte array. I have gone to a solution http://support.microsoft.com/kb/322091[^] but didn''t get any help.
With the help of this code I can send bytes to printer but printer gives me error as document can''t be printed.
Thanks in advance.
Regards,
Puneet Sharma
Resist the temptation of sending raw data.
Print your string in graphic mode, which will give you guaranteed universal printer-independent solution. All you need it to use the classSystem.Drawing.Printing.PrintDocument
:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^].
You will find a simple code sample in this article.
—SA
这篇关于如何将字节数组直接打印到网络打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!