C#-打印收据 [英] C# - Printing Receipt

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

问题描述

我刚刚安装了EPSON TM-T90收据,我想使用C#进行测试.
我尝试使用谷歌搜索,但还没有学到很多...

我想做的就是简单地打印一行代码,例如"Hello World".
我尝试使用以下内容:

I just installed my EPSON TM-T90 Receipt and I wanna test it using C#.
I tried googling it, but haven''t learned much about it...

What I want to do is simply print a line of code, for example "Hello World".
I tried using the following:

char esc = (char)27;
char ff = (char)12;
SerialPort port = new SerialPort("COM3", 19200, Parity.None, 8, StopBits.One);
port.Open();
port.Write(esc + "@Hello World!" + ff);
port.Close();



但是它说对COM3的访问被拒绝.
它已安装,我使用的是已安装所有内容的官方高级驱动程序,它会显示在我的可用打印机中,当我安装它时,我选择了正确的端口COM3,并且已经配置了串行接口.



Yet it says that access to COM3 was denied.
It''s installed, I used the official advanced driver that installed everything, it''s showing in my available printers and when I installed it I selected the correct port which is COM3 and configured the Serial Interface already.

推荐答案

驱动程序将对该串行端口具有独占权,以便
驱动打印机,从而保护自己免受恶意代码的侵害.为什么不只是通过标准的打印实用程序和类使用普通的打印处理呢?
The driver will have exclusive rights to that serial port in order to
drive the printer, and so protect itself from malicious code. Why not just use normal print processing via the standard printing utilities and classes?


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

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