【问题标题】:How to send image with text to printer using IPP protocol如何使用 IPP 协议将带有文本的图像发送到打印机
【发布时间】:2020-05-29 01:57:51
【问题描述】:

我有一个程序,我使用 IPP 协议从 node.js 服务器向打印机发送命令。我在这里使用

var ipAddress='127.0.0.1';
var Printer = ipp.Printer("http://".concat(ipAddress).concat("/ipp/print"));
var dt = "";
dt = dt.concat("SINCOS Vending Machine Demo.\n\r", "Contact:       ", phone, "\n\rProduct:       ", product, "\n\rQuantity:      ", quantity, "\n\rPrice:         ", price, "\n\r");
var buffer1 = new Buffer(dt, 'utf8');
var msg = {
  "operation-attributes-tag": {
  "requesting-user-name": "John Doe"
  },
  "job-attributes-tag": {
    "media": "na_letter_8.5x11in"
  },
  data: buffer1
};
Printer.execute("Print-Job", msg, function (err, suc) {
  return res.send({error: false, message: suc});
});

在这里,我需要添加同样将打印在同一个文档中的条形码或图像。我该怎么做?

【问题讨论】:

  • 打印机支持哪些文档格式 (pdl)?
  • 我不知道。我使用的是三星的 M262x 282x 系列打印机。
  • 使用 IPP,您可以查询打印机对象属性“document-format-supported”以获取可以打印的文件格式列表。

标签: javascript node.js network-printers ipp-protocol


【解决方案1】:

通常 IPP 只处理作业提交,就像将文档(以打印机支持的格式)发送到打印机一样。 IPP 绝不为应用程序文档提供渲染引擎。

您打算使用什么document-format 或您的打印机支持什么?它看起来应该是简单的文本和图形,但可能需要实现打印机特定的控制代码。如果您使用 PDF 或 Postscript,您应该会找到大量能够为您的打印机生成/渲染所需文档格式的库和工具。

示例:如果您的打印机支持 postscript,您可以使用 barcode Postscript 库。

有关实施思路,另请参阅:

【讨论】:

    猜你喜欢
    • 2012-01-24
    • 1970-01-01
    • 2013-04-18
    • 2023-04-10
    • 2016-01-07
    • 1970-01-01
    • 2015-07-18
    • 2016-07-26
    • 2020-05-19
    相关资源
    最近更新 更多