美好的一天。
我一直在使用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);
}
}
答案 0 :(得分:0)
POS打印机在线打印。例如,
private void printLogoTest(String pathImage){
ptr.printNormal(POSPrinterConst.PTR_S_RECEIPT,
"Text at the above logo. \r\n \r\n \r\n");
ptr.printBitmap(POSPrinterConst.PTR_S_RECEIPT,
pathImage,
POSPrinterConst.PTR_BM_ASIS,
POSPrinterConst.PTR_BC_CENTER);
ptr.printNormal(POSPrinterConst.PTR_S_RECEIPT,
"Text at the above Below.");
}
此示例方法将打印文本,送入3行,然后打印徽标,然后在徽标下方打印文本。