如何使用WPF c#打印prn文件 [英] How to print prn file using WPF c#

查看:708
本文介绍了如何使用WPF c#打印prn文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我用c#创建了一个.prn文件。如何在热敏打印机中打印prn文件。

使用并行端口(LTP1,LTP2 ...)



我的文本在.prn文件如下

Hello,

I have created a .prn file using c#. how can i print prn file in thermal printer.
using parallel port (LTP1, LTP2 ...)

My Text in .prn file is as below

            * RETAIL INVOICE *
          ABCD EFG HIJ KLMNOP QRST
              Banglore
            Mob No: 5652323232332
           VAT No: 56565656565656
Bill No: 398 Date: 20/01/2016 8:50 PM
               [Duplicate]
------------------------------------------
Item                     Qty   Rate Amount
------------------------------------------
TEST My PRODUCT 11     1.000 400.00 400.00
------------------------------------------
Subtotal                            400.00
              CASH : 400.00
      Total Scheme Discount : 3.19%
        Thank You Visit Again  :-)
 
di





请咨询。



我们如何使用c#打印此文档。有没有办法打印这个文件。

请建议。



谢谢



Please advice.

How can we print this document using c#. Is there any way to print this file.
Please suggest.

Thanks

推荐答案

具体而言,如果与WPF无关,但您可以使用.NET执行此操作。这不是一种自然的打印方式。这个想法是:你必须执行copy / b(/ b表示二进制,或者,在这种情况下,按原样)命令将文件复制到打印机。您需要使用共享打印机 UNC路径名称(另请参阅下面的第二个最后一个链接示例),或使用默认打印机(prn,并且应配置打印机)。要以编程方式执行此操作,您需要使用 System.Diagnostics.Process.Start

Process.Start Method(System.Diagnostics) [ ^ ] 。



基本上就是这样。另见:

C#Corner:错误显示 [ ^ ],

直接使用C#.net 打印* .prn文件[ ^ ]。



我希望您了解应该为兼容的打印机型号获取PRN文件。如果不匹配,您只能获得打印机故障或只是垃圾。



-SA
If has nothing to do with WPF, specifically, but you can do it with .NET. This is not a natural way of printing though. The idea is: you have to perform a "copy /b" ("/b" means "binary", or, in this case, "as is") command to copy your file to a printer. You would need to use your shared printer UNC path name (see also second last link below for an example), or use default printer ("prn", and the printer should be configured). To do it programmatically, you will need to use System.Diagnostics.Process.Start:
Process.Start Method (System.Diagnostics)[^].

Basically, that's all. See also:
C# Corner : Error Display[^],
Directly print *.prn files using C#.net[^].

I hope you understand that your PRN file should be obtained for a compatible model of a printer. In case of mismatch, you can get only printer malfunction or just garbage.

—SA


这篇关于如何使用WPF c#打印prn文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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