0

デフォルトのプリンターにテキストを送信するための最適なオプションは何ですか?

プリンターは Zebra で、テキストは ZPL の文字列です。

フォント サイズ、グラフィックス、ポイント (x,y) に関する多くの例があります。非常に紛らわしいです。

しかし、文字列を送信する必要があり、プリンターはその作業を行います。

4

2 に答える 2

2

Zebra プリンタはネットワーク上にありますか?

もしそうなら、これはうまくいく -

// Printer IP Address and communication port
string ipAddress = "10.3.14.42";
int port = 9100;

// ZPL Command(s)
string ZPLString =
"^XA" +
"^FO50,50" +
"^A0N50,50" +
"^FDHello, World!^FS" +
"^XZ";

try
{
    // Open connection
    using (System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient())
    {
        client.Connect(ipAddress, port);

        // Write ZPL String to connection
        using (System.IO.StreamWriter writer = new System.IO.StreamWriter(client.GetStream()))
        {
            writer.Write(ZPLString);
            writer.Flush();
        }
    }
}
catch (Exception ex)
{
     // Catch Exception
}

私はこのライブラリを USB にも使用しました。

于 2013-10-04T04:03:49.113 に答える