【问题标题】:Electron Pos Printer prints empty receiptElectron Pos 打印机打印空收据
【发布时间】:2022-10-20 20:50:13
【问题描述】:

我正在使用这个库Electron Pos Printer,并且我已经做了一小批代码。我已经成功连接了我的 POS 热敏打印机,但是当我发送打印命令时,它只“打印”了少量的空白纸。关于解决这个问题的任何想法,或者可能是对其他库的推荐?

let printerName = "myprinter";
let widthPage = "155";
const data = [
    {
        type: "text", // 'text' | 'barCode' | 'qrCode' | 'image' | 'table
        value: "This is sample print job",
        style: `text-align:center;font-size:16px;`,
    },
    {
        type: "qrCode",
        value: "https://github.com/fssonca",
        height: 55,
        width: 55,
        style: "margin-left:50px",
    },
];
PosPrinter.print(data, {
    preview: false, // Preview in window or print
    width: widthPage, //  width of content body
    margin: "0 0 0 0", // margin of content body
    copies: 1, // Number of copies to print
    printerName: printerName, // printerName: string, check it at webContent.getPrinters()
    timeOutPerLine: 400,
    silent: true,
}).catch((err) => console.log(err));

【问题讨论】:

    标签: javascript reactjs printing electron


    【解决方案1】:

    让 widthPage = "155";

    尝试更改 widthPage="155px"

    【讨论】:

      猜你喜欢
      • 2019-04-14
      • 2012-07-12
      • 2012-03-13
      • 2014-11-16
      • 2012-10-11
      • 1970-01-01
      • 2014-09-24
      • 2016-06-23
      相关资源
      最近更新 更多