【问题标题】:Print Bitmap to ESC/POS printer将位图打印到 ESC/POS 打印机
【发布时间】:2015-08-22 11:14:50
【问题描述】:

我正在尝试打印到与 ESC/POS 兼容的打印机,并且正在努力让我的头脑了解 GS v 0。我刚刚从 Mac 连接并通过 CoolTerm 发送命令是 hex

文档说...

  GS v 0 m xL xH yL yH d1....dk
  -----------------------------------------------------
  [Name] Print raster bit image
  [Format] ASCII GS v 0 m xL xH yL yH d1....dk
  Hex 1D 76 30 m xL xH yL yH d1....dk
  Decimal 29 118 48 m xL xH yL yH d1....dk
  [Range] 0≤xL≤48, xH=0; 0≤yL≤255, yH=0; 0≤d≤255
  k=(xL+xH×256)×(yL+yH×256)(k≠0)
  [Description] Selects Raster bit-image mode. The value of m selects the mode, as follows:
+------+------------+----------------------------+---------------------------+
|  m   |    MODE    |      Vertical Dot Density  |  Horizontal Dot density   |
+------+------------+----------------------------+---------------------------+
|0, 48 |   Normal   |          200 DPI           |        200 DPI            |
+------+------------+----------------------------+---------------------------+
|1, 49 |Double-width|          200 DPI           |        100 DPI            |
+------+-------------+---------------------------+---------------------------+
|2, 50 |Double-height|         100 DPI           |        200 DPI            |
+------+-------------+---------------------------+---------------------------+
|3, 51 | Quadruple  |          100 DPI           |        100 DPI            |
+------+-------------+---------------------------+---------------------------+

 • xL, xH, select the number of data bits ( xL+ xH × 256) in the horizontal direction for the bit image.
 • yL, yH, select the number of data bits ( yL+ yH × 256) in the vertical direction for the bit image.
 • This command has no effect in all print modes (character size, emphasized, double-strike, upside-down, underline, white/black reverse printing, etc.) for raster bit image.
 • The part of bit image that exceeds the printable area will not be printed.
 • d indicates the bit-image data. Set time a bit to 1 prints a dot and setting it to 0 does not print a dot.

因此我推断我需要在HEX 中发送以下内容

 1D 76 30 30 20 00 00 01

图像数据现在是否遵循此,我是否必须发送消息说图像已结束?

【问题讨论】:

    标签: printing thermal-printer


    【解决方案1】:

    我记得有 <ESC>K(不是 GS)命令打印 8 行像素。有关详细信息,请参阅 ESC 命令。在 K 之后必须发送 2 个字节 - 数据字节数和实际数据。但不能保证是否每台打印机都支持这一点。你的品牌和型号是什么?

    【讨论】:

      【解决方案2】:

      docs 说:

      Hex 1D 76 30 m xL xH yL yH d1....dk
      

      m 是 0x48..0x51,所以你不能发送

      1D 76 30 30 20 00 00 01
      

      而是例如

      1D 76 30 48 20 00 00 01
      

      我认为 xHyL 为 0 没有多大意义。

      【讨论】:

        猜你喜欢
        • 2017-10-21
        • 2014-12-14
        • 2018-12-18
        • 2019-08-15
        • 1970-01-01
        • 1970-01-01
        • 2020-02-11
        • 2013-07-01
        • 2016-09-12
        相关资源
        最近更新 更多