3

Esc/Pos を使用して、ビットマップ イメージをプリンターの NV グラフィック メモリにアップロードしたいと考えています。

GS ( L / GS 8 L <Function 67>Esc/Pos マニュアルを使用しています。

すべてまたは 1 つのグラフィックを使用<Function 65>および削除できます。<Function 66>

Bitmap を関数に追加するときに何かが足りないことはわかっています。

Heres は、ビットマップを含む私のコマンド文字列です。には、ビットマップのbitmapStringファイル ヘッダーと情報ヘッダーが削除されています (最初の 62 バイト)(DataOffset):

String bitmapString = new String(bitmapBytes, Charsets.US_ASCII);
bitmapString = bitmapString.substring(DataOffset, bitmapStringSize);
String commandString = "";

int commandLength = (bitmapStringSize.length) + 11;
    pL = commandLength % 256;
    if (commandLength < 256) {
        pH = 0;
    } else {
        pH = (commandLength - pL) / 256;
    }

    xL = bitmapWidth % 256;
    if (bitmapWidth < 256) {
        xH = 0;
    } else {
        xH = (bitmapWidth - (bitmapWidth % 256)) / 256;
    }

    yL = bitmapHeight % 256;
    if (bitmapHeight < 256) {
        yH = 0;
    } else {
        yH = (bitmapHeight - (bitmapHeight % 256)) / 256;
    }

    commandString
            += Utils.H("1B")// 27
            + Utils.H("40") // 64
            + Utils.H("1B") // 27
            + Utils.H("3D") // 61
            + Utils.H("01") // 1

            + Utils.H("1D") // GS = 29
            + Utils.H("28") // ( = 40
            + Utils.H("4C") // L = 76

            + Utils.D(pL)   // pL
            + Utils.D(pH)   // pH

            + Utils.H("30") // m = 48
            + Utils.H("43") // fn = 67
            + Utils.H("30") // a = 48

            + Utils.H(KC1)  // kc1
            + Utils.H(KC2)  // kc2

            + Utils.H("01") // b = 1

            + Utils.D(xL)   // xL
            + Utils.D(xH)   // xH
            + Utils.D(yL)   // yL
            + Utils.D(yH)   // yH

            + Utils.H("31");// c = 49

    commandString += bitmapString;

ePOS-Print.jar を使用して、プリンターを開いて書き込みます。

EpsonIo epsonio = new EpsonIo();
byte[] commandBytes = commandString.getBytes(Charsets.US_ASCII);

        epsonio.open(DevType.BLUETOOTH, MAC, null, ESCPosService.this);

        while (n > 0) {

            epsonio.write(commandBytes, i, n > bufferSize ? bufferSize : n, SEND_TIMEOUT);

            Thread.sleep(450);

            i += bufferSize;
            n -= bufferSize;
        }

しかし、グラフィックを印刷すると歪んでいます:

ここに画像の説明を入力

4

1 に答える 1