简体   繁体   English

如何使用 IPP 协议将带有文本的图像发送到打印机

[英]How to send image with text to printer using IPP protocol

I have a program where I am sending command to the printer using IPP protocol from a node.js server.我有一个程序,我使用 IPP 协议从 node.js 服务器向打印机发送命令。 I am using here我在这里使用

 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}); });

Here I need to add a barcode or an image that also will be printed in the same document.在这里,我需要添加也将打印在同一文档中的条形码或图像。 How can I do it?我该怎么做?

Usually IPP only takes care of the job submission as in sending a document (in a format supported by the printer) to the printer.通常,IPP 只负责向打印机发送文档(以打印机支持的格式)提交作业。 IPP by no means provides a rendering engine for application documents. IPP 绝不为应用程序文档提供渲染引擎。

What document-format do you intend to use or does your printer support?您打算使用什么文档格式或您的打印机支持什么? It looks like simple text and graphics should to the job but could require to implement printers specific control codes.看起来简单的文本和图形应该适合这项工作,但可能需要实现打印机特定的控制代码。 If you use PDF or Postscript you should find plenty of libraries and tools that are able to produce/render the required document format for your printer.如果您使用 PDF 或 Postscript,您应该会找到大量能够为您的打印机生成/呈现所需文档格式的库和工具。

Example: If your printer supports postscript you could use a barcode Postscript library.示例:如果您的打印机支持 postscript,您可以使用条形码 Postscript库。

for implementation ideas see also:实现思路另见:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM