node-escpos icon indicating copy to clipboard operation
node-escpos copied to clipboard

Table working incorrect

Open ngvcanh opened this issue 4 years ago • 3 comments

I using:

  • electron: ^11.1.1
  • escpos: ^3.0.0-alpha.6

The following code I use to print data for the table

printer
    .tableCustom([
      { text: '메뉴 x 수량', width: 0.3, align: 'LEFT' },
      { text: '금액', width: 0.4,  align: 'RIGHT' }
    ], { encoding: 'EUC-KR' });
    printer.drawLine();
    data.foods.map(food => {
      printer.tableCustom([
        { text: food.food_name + ' x ' +  food.quantity, width: 0.3, align: 'LEFT' },
        { text: food.total_price, width: 0.4, align: 'RIGHT' }
      ], { encoding: 'EUC-KR' });
    });
    printer
    .tableCustom([
      { text: '배달비', width: 0.4, align: 'LEFT' },
      { text: data.delivery_fee, width: 0.4, align: 'RIGHT' }
    ]);

And receipt when I print with 2 datas

Imgur

Imgur

It seems that calculating the text length and cell width doesn't work properly

ngvcanh avatar Jan 09 '21 04:01 ngvcanh

Hey @ngvcanh , were u able to find a solution for this?

shraey-chikker avatar Jul 23 '22 05:07 shraey-chikker

Hey @ngvcanh , were u able to find a solution for this?

I haven't worked with it for a long time. However I did rewrite some of the code, check it out

https://github.com/ngvcanh/node-printer

I'm planning to rewrite it with Typescript, but time doesn't allow me to do that

ngvcanh avatar Jul 24 '22 12:07 ngvcanh

Hey @ngvcanh , were u able to find a solution for this?

I haven't worked with it for a long time. However I did rewrite some of the code, check it out

https://github.com/ngvcanh/node-printer

I'm planning to rewrite it with Typescript, but time doesn't allow me to do that

Hi~ @ngvcanh I need your help about table styling. please Help me. Thank you for advance.

Louis-jk avatar Oct 04 '22 08:10 Louis-jk