在.net 中的点阵打印机上打印 [英] print on dot matrix printer in .net

查看:43
本文介绍了在.net 中的点阵打印机上打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我如何在 C# windows 应用程序中的点阵打印机上打印文档的代码.

解决方案

您可以以图形方式"打印到点阵,这是 Windows 内置的,但速度较慢.

但是如果您只想打印具有简单格式的纯文本,则需要向您的点阵打印机发送转义命令,这比图形打印要快.不同的打印机有不同的转义命令.

以下是典型的转义命令(用于 epson):http://www.printfil.com/manualen/c5.htm

这可能有帮助:https://web.archive.org/web/20051212193242/http://sacpcug.org:80/archives/0306/prc0603.html

然后我在 VB6 中做的是打印到 Generic/Text Only 打印机,你打开 PRN 或 LPT1 作为文件句柄,然后在文件句柄上打印转义命令,所有转义命令都会被重定向到连接到 LPT1 或 PRN 的任何打印机.你可以用 C# 做同样的事情,只需将 PRN 或 LPT1 作为文件打开,然后打印到它.

要添加通用/纯文本打印机,请控制面板 > 打印机 > 添加打印机.在制造商上,选择 Generic,然后在打印机上,选择 Generic/Text only.

您可以对 Zebra 打印机执行相同的操作(在 Generic/Text Only 上打印),这些打印机具有用于打印条码的自己的转义命令,这比让 Windows 以图形方式打印更快.>

anyone can please tell me the code how to print documents on dot matrix printer in C# windows application.

解决方案

You can print to dot matrix "graphically", which is built-in in Windows, albeit slower.

But if you only want to print pure text with simple formattings, you need to send escape commands to your dot matrix printer, which is faster than graphical printing. Different printers has different escape commands.

Here are typical escape commands(for epson): http://www.printfil.com/manualen/c5.htm

This might help: https://web.archive.org/web/20051212193242/http://sacpcug.org:80/archives/0306/prc0603.html

What I do in VB6 then was to print to Generic / Text Only printer, you open the PRN or LPT1 as a file handle, then print escape commands on the file handle, all escape commands will be redirected to whatever printer is attached to LPT1 or PRN. You can do the same thing with C#, just open the PRN or LPT1 as a file, then print to it.

To add Generic / Text Only printer, Control Panel > Printers > Add Printer. On manufacturer, select Generic, then on printers, select Generic / Text only.

You can do the same (printing on Generic / Text Only) for Zebra printers which have their own escape commands for printing bar codes, which is faster than letting Windows print to it graphically.

这篇关于在.net 中的点阵打印机上打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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