3

I have a program where I am sending command to the printer using IPP protocol from a node.js server. 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?

Rup
  • 33,765
  • 9
  • 83
  • 112

1 Answers1

1

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 by no means provides a rendering engine for application documents.

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.

Example: If your printer supports postscript you could use a barcode Postscript library.

for implementation ideas see also:

IPP Nerd
  • 992
  • 9
  • 25