通过C#在(并行端口)点矩阵中打印 [英] Printing in (Parallel Port) Dot Matrix over C#

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

问题描述

对于项目的需要,我想在LPT1上的特定位置进行打印,这将在点阵打印机中打印文档,我应该在该位置打印值.我真的很讨厌回去,而且我不知道从哪里开始. Internet没有有关使用C#在LPT端口中进行打印的特定信息,尤其是在打印时如何在特定位置发送值.有什么好的例子吗?本教程?会是救生员.

For the needs of a project, i want to print over the LPT1 in specific locations, this will print a document in a dot matrix printer where i should print values in the places they should go. I really hate going back, and i don't have any idea where to start. Internet has no specific information about printing in LPT port with C# and especially how to send the values in specific locations while printing. Is there any good example? tutorial for this? would be a life savior.

推荐答案

我建议采取一件事以使您的生活更轻松,安装通用文本打印机驱动程序(这是标准配置)并将其设置为LPT1端口.然后,您只需打开"LPT1"并发送转义码序列来指定字体类型(粗体/斜体),强调,字体间距等.我不知道是否需要资源.但我想这会是这样的:

I could suggest one thing to make your life easier, install a generic text printer driver (this comes as standard) and set that to the LPT1 port. Then you can simply open 'LPT1' and send escape code sequences to specify font type (bold/italic), emphasized, font pitch etc. I don't know if the resources would be required. But I would imagine it would be something like this:


System.IO.StreamWriter sr = new System.IO.StreamWriter(@"\\.\LPT1");
sr.Write(0x1b); sr.Write('k'); sr.Write('1'); sr.Write("Hello"); // print in Sans Serif
sr.WriteLine();
sr.Flush();
sr.Close();

资源:

  • 打印到斑马打印机(可以轻松转换为C#或将其编译为DLL并在您的C#项目中引用它)
  • MSDN 上有关如何与LPT1接口的文章
  • 以下是与
  • 这是 MSDN 上的另一篇文章,显示了如何进行原始打印.
  • Printing to a zebra printer using VB.NET (This can be easily translated to C# or compile it to a DLL and reference it in your C# project)
  • An article on MSDN on how to interface to LPT1
  • Here is an extensive list of info pertaining to Parallel Port. (look further down near the section titled 'Programming Tools for Port I/O and Interrupts'), discussing the usage of this DLL called inpout32.
  • Here is another article on MSDN that shows how to do raw printing.

编辑于2017年7月12日:更新了并行端口链接以使用Wayback存档机.

Edited @ 2017-07-12: Updated the Parallel Port link to use the Wayback Archive Machine.

这篇关于通过C#在(并行端口)点矩阵中打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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