在C#点阵打印? [英] Dot Matrix printing in C#?

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

问题描述

我试图打印到点阵打印机(各种型号)进行了C#,目前我使用的Win32 API(你可以找到很多的例子在线)调用直接发送转义码到打印机出我的C#应用。这个伟大的工程,但...

I'm trying to print to Dot Matrix printers (various models) out of C#, currently I'm using Win32 API (you can find alot of examples online) calls to send escape codes directly to the printer out of my C# application. This works great, but...

我的问题是,因为我生成转义码,而不是靠窗户打印系统打印输出不能被发送到任何正常的打印机或之类的东西PDF打印驱动程序。 (这是造成现在,我们正在尝试使用[基于哪个XPS]轻松打印使用2008终端服务器上的应用程序有问题)

My problem is because I'm generating the escape codes and not relying on the windows print system the printouts can't be sent to any "normal" printers or to things like PDF print drivers. (This is now causing a problem as we're trying to use the application on a 2008 Terminal Server using Easy Print [Which is XPS based])

现在的问题是:
我如何打印格式的文档(发票预印固定的)到点阵打印机(爱普生,冲电气和松下...各种型号)出C#不使用直接打印,转义码等。

The question is: How can I print formatted documents (invoices on pre-printed stationary) to Dot Matrix printers (Epson, Oki and Panasonic... various models) out of C# not using direct printing, escape codes etc.

**只是为了澄清,我正在努力之类的东西GDI +(System.Drawing.Printing),但问题是,它很辛苦,得到的东西去排队像旧代码没有。 (旧代码发送的字符直接向打印机绕过Windows的驱动程序。)任何建议的事情如何加以改进,使他们可以使用GDI +,但仍然排队如旧代码做?

**Just to clarify, I'm trying things like GDI+ (System.Drawing.Printing) but the problem is that its very hard, to get things to line up like the old code did. (The old code sent the characters direct to the printer bypassing the windows driver.) Any suggestions how things could be improved so that they could use GDI+ but still line up like the old code did?

推荐答案

您应该使用一个报表工具,使模板,让您或用户正确定位与问候预印刷文具等领域。

You should probably use a reporting tool to make templates that allow you or users to correctly position the fields with regards to the pre-printed stationery.

使用点阵打印机,你基本上在任的2种模式工作:

Using dot-matrix printers, you basically have to work in either of 2 modes:


  • 简单类型您发送转义序列行/列文-writer模式来管理一小部分包含在打印机硬件字体,并有管理线的回报,等等。

  • 图形输出,其中该页面光栅和打印机驱动程序只是驱动打印头和引脚输出点。

在第一次使用时,大多数情况下不建议使用窗口,因为它不提供多少在控制输出的方式,并具有其自身的特性的每个打印机变得笨拙和困难的软件来预测和页(无所见即所得)上的位置的事情。

The first usage is mostly deprecated under Windows as it does not offer much in the way of controlling the output, and each printer having its own characteristics it becomes unwieldy and difficult for the software to predict and position things on the page (no WYSIWYG).

第二只使用一个图形页范例,使独立的打印机。

的实际能力定位文本和图形时使用预印刷文具,你的工作s到数据正确放置在页面上。

做手工这肯定是不推荐消耗资源和创造的代码布局,因为你会得到坚持与代码变化应打印机,网页格式或印刷文具变化。

The second just uses a graphic page paradigm that makes positioning text and graphics independent of the actual capabilities of the printer.
When using pre-printed stationery, your job s to correctly position the data on the page.
Doing this by hand is resource-consuming and creating the layout in code is certainly not recommended since you'll get stuck with code to change should your printer, page format or printed stationery change.

最好是只使用由.Net和报告工具,它允许您定义的模型和模板,提供了标准的打印模型,其中正确的文本和图形将被定位,然后从代码驱动这个。

The best is to just use the standard printing model offered by .Net and a reporting tool that allows you to define models and templates where the correct text and graphics will be positioned, and then drive this from code.

Visual Studio是附带一个版本的Crystal Reports但也有其他更好的报告制度(我用的是一个来自开发商表示例如),其中一些甚至是免费的

Visual Studio is shipped with a version of Crystal Reports but there are other, better reporting systems (I use the one from developer express for instance), some of them are even free.

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

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