0

小条打印机输出简析

 3 years ago
source link: https://www.cnblogs.com/TianFang/p/14045635.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

最近有项目涉及到了小条打印机(就是超市里的那种打印单据的打印机)的打印,和传统固定大小纸张打印机相比,小条打印机有着高度可变的特点。便简单的研究了一下。

实验过程还是比较顺利的,本以为小条打印机需要专门的打印指令,结果发现是可以用传统的打印机驱动方式打印的,纸张上输出和小条打印机上的输出对比结果见下图:

12132-20201127005455487-1324019937.png

输出特点:

  1. 可以用普通打印机的驱动打印,普通的打印程序都可以在小条打印机上使用。
  2. 小条输出高度取决于可见部分内容的高度。底部空白内容的高度会被忽略掉,并不等价于预设的纸张高度。
  3. 会在可见内容加上空白边距。输出部分宽度为小条宽度减去边距。

打印要点:

  1. 无需为小条打印页面布局设置边距,打印机会自动留边距。
  2. 最好指定页面宽度。一般58mm打印机,对应为180像素。
  3. 需要保证左侧有内容输出空白内容可能会被裁掉,导致在打印机上无输出。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK