简体   繁体   English

c# 使用 usb 电缆从打印机打印,不使用 ip 地址或共享打印机

[英]c# Print from the printer using usb Cable, without using ip address or shared printer

I'm looking for how to print from the printer without using an IP address or sharing the printer.我正在寻找如何在不使用 IP 地址或共享打印机的情况下从打印机打印。

i am using the code below and i used the ip address \127.0.0.1\Citizen_CL-S700 for the printer but now i need to print without share the printer or use usb cable我正在使用下面的代码,我使用 ip 地址 \127.0.0.1\Citizen_CL-S700 作为打印机,但现在我需要在不共享打印机的情况下打印或使用 usb 电缆

StreamWriter writer = new StreamWriter(PrintFolder + @"\MEFU_" + Cmb_Serial_Print.Text + ".prn", true);
                        writer.Write(content);
                        writer.Close();

                        File.Copy(PrintFolder + @"\MEFU_" + Cmb_Serial_Print.Text + ".prn",\\127.0.0.1\Citizen_CL-S700);

Usage:用法:

 using RawPrint;

    // Create an instance of the Printer
    IPrinter printer = new Printer();

    // Print the file
    printer.PrintRawFile(PrinterName, Filepath, Filename);

Installation:安装:

To install Raw Print, run the following command in the Package Manager Console要安装 Raw Print,请在 Package 管理器控制台中运行以下命令

PM> Install-Package RawPrint

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM