【发布时间】:2019-02-26 14:36:22
【问题描述】:
美好的一天。
我一直在使用 printBitmap 方法在热敏收据上打印图像,我可以将图像居中或对齐到左侧或右侧,但我无法确定图像的打印位置(它总是打印在收据的顶部) 我想知道是否可以设置坐标以在我想要的位置打印图像。 在此先感谢您能给我的任何帮助。 这是处理图像打印的代码段:
private void init() {
if (ptr == null) {
if (logger.isTraceEnabled()) {
logger.trace("Init ptr=null portName=" + portName);
ptr = new POSPrinter();
try {
ptr.open(portName);
ptr.addStatusUpdateListener(this);
} catch (JposException e) {
ptr = null;
throw new DeviceServerRuntimeException(ErrorCode.JPOS_PRINTER_ERROR, e);
}
if (logger.isTraceEnabled()) {
logger.trace("Init portName=" + portName);
}
}
}
public void printImage(String pathImage) {
try {
ptr.printBitmap(currentTargetDevice, pathImage, POSPrinterConst.PTR_BM_ASIS, POSPrinterConst.PTR_BM_CENTER);
} catch (JposException e) {
throw new DeviceServerRuntimeException(ErrorCode.JPOS_PRINTER_ERROR, e);
}
}
【问题讨论】:
-
要获得建议,请添加有关您要打印的布局的详细信息。
-
您好,是 jpg 图像,我可以打印它,但不是我想要的,它总是打印在收据的顶部。 @kunif
-
不要重复文中已经写过的问题,请将示例布局添加为图形,然后说明要打印的文本位置和图像位置。