lsongdev / lsongdev/node-escpos

Table working incorrect

Open
#333 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.6k
Forks
443
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with the provided Electron and escpos snippet, then read the tableCustom implementation and its existing tests, if present. Compare receipts with two food rows and verify that text lengths, column widths, and EUC-KR output align consistently before considering the issue complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript, node.js
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.