3

私はたくさん検索しましたが、ここで Posexplorer の例を見つけましたが、私のプリンターは USB で、PosExplorer は並列用であると読みました。プリンターで印刷する方法と、コードをプリンターに送信して引き出しを開く方法がわかりません。

次のコードを使用して、エスケープシーケンスをプリンターに送信しています。

string ESC = Convert.ToString((char)27);
string logo=Convert.ToString(ESC+"|tL");
_oposPrinter.PrintNormal(PrinterStation.Receipt, logo);
_oposPrinter.PrintNormal(PrinterStation.Receipt, "Print example\n");
_oposPrinter.PrintNormal(PrinterStation.Receipt, Convert.ToString((char)27 + "|#fP"));

デバッグして行に到達すると:

_oposPrinter.PrintNormal(PrinterStation.Receipt, logo);

また

_oposPrinter.PrintNormal(PrinterStation.Receipt, Convert.ToString((char)27 + "|#fP"));

プリンターは何も印刷しません。

4

3 に答える 3

6

Microsoft POS for .NET などのサードパーティ製ソフトウェアをインストールせずに、非常に軽量なソリューションを探している場合。

関数RawPrinterHelperを含める必要があります ( https://support.microsoft.com/en-us/help/322091/how-to-send-raw-data-to-a-printer-by-using-からダウンロードできます) 。 visual-c-.net )

次に、特定のキャッシュ ドロワー コードを送信して、接続されているプリンターに開きます。

たとえば、Epson TM88 では、この関数はそれを開きます。

SendStringToPrinter(printerName, System.Text.ASCIIEncoding.ASCII.GetString(new byte[] { 27, 112, 48, 55, 121 }));

他のプリンタでは、他のコード シーケンスが必要になる場合があります。

Citizen
27,112,0,50,250
Epson 
27,112,48,55,121
27,112,0,25,250
27,112,48,25,250
IBM
7

... ( http://keyhut.com/popopen.htmで自動カッターまたは 2 番目の引き出しを含むその他のコードを表示)

于 2012-04-24T17:56:59.853 に答える
0

私はこのコードが通常の印刷で機能することを知っています。私はキャッシュドロワー部分をテストしていませんが、それは正しいコマンドだと思います。それを使用するための正しいパラメーターを知っている必要があります。

このコードは、Epsonが提供するユーティリティSetupPos.exeを使用してプリンタを設定していることを前提としています。どこで入手したかは覚えていませんが、EpsonExpert.comは見るのに良い場所かもしれません。次に、正しいLDNを渡していることを確認します(setupposソフトウェアで設定します)。

    PosExplorer explorer = null;
    DeviceInfo _device;
    PosPrinter _oposPrinter;
string LDN;

    explorer = new PosExplorer();
    _device = explorer.GetDevice(DeviceType.PosPrinter, LDN);
    _oposPrinter = (PosPrinter)explorer.CreateInstance(_device);
    _oposPrinter.Open();
    _oposPrinter.Claim(10000);
    _oposPrinter.DeviceEnabled = true;
 // normal print
    _oposPrinter.PrintNormal(PrinterStation.Receipt, yourprintdata); 
// pulse the cash drawer pin  pulseLength-> 1 = 100ms, 2 = 200ms, pin-> 0 = pin2, 1 = pin5
    _oposPrinter.PrintNormal(PrinterStation.Receipt, (char)16 + (char)20 + (char)1 + (char)pin + (char)pulseLength); 

// cut the paper
    _oposPrinter.PrintNormal(PrinterStation.Receipt, (char)29 + (char)86 + (char)66)

// print stored bitmap
    _oposPrinter.PrintNormal(PrinterStation.Receipt, (char)29 + (char)47 + (char)0)
于 2011-12-15T20:14:49.117 に答える
0

VB.NET と POS.NET でこれを行おうとしている場合は、これをプリンターに送信します。

m_printer = the instance you created for the PosExplorer
m_printer.PrintNormal(PrinterStation.Receipt, System.Text.ASCIIEncoding.ASCII.GetString(New Byte() {27, 112, 48, 55, 121}))

これは私のEpson TM-T20で機能しました

奇妙なことに、最初の送信では開かず、その後は毎回開かれます。

于 2013-05-08T02:51:50.097 に答える