Skip to content

Setting the margins does not work #36

@carbon-steel

Description

@carbon-steel

Hi, I'm trying to have my text not be so close to the edges of my receipt, but it does not seem to be working. Here is the code I am running

const escpos = require('escpos');
 
const device  = new escpos.USB();

const printer = new escpos.Printer(device);

function printItems(items){
  device.open(function(){
    printer.font('a')
      .style('NORMAL')
      .size(1,1);
    items.forEach(function(item) {
      printer.align("LT")
        .marginLeft('8')
        .marginRight('8')
        .marginBottom('8')
        .print(item["name"])
        .control("HT")
        .println(parseFloat(item["price"]));
    });
  });
}

var items = [
  {"name": "hotdog",
    "price" : 2.01}
];
printItems(items);

device.open(function(){
  printer.cut();
  printer.close();
});

When the receipt prints, the text is right up against the left and bottom edges (the text is not long enough to reach the right edge).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions