lsongdev / lsongdev/node-escpos

How to print the text from the next line, if the word extends the paper?

Open
#241 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am working with the default example and its working fine. The only thing I have changed is that I have increased the length of english text to be printed.

```
device.open(function(){
printer
.font('a')
.align('ct')
.style('bu')
.size(1, 1)
.text('"The quick brown fox jumps over the lazy dog" is an English-language pangram—a sentence that contains all of the letters of the alphabet.')
.text('敏捷的棕色狐狸跳过懒狗')
.barcode('1234567', 'EAN8')
.table(["One", "Two", "Three"])
.tableCustom([
{ text:"Left", align:"LEFT", width:0.33 },
{ text:"Center", align:"CENTER", width:0.33},
{ text:"Right", align:"RIGHT", width:0.33 }
])
.qrimage('https://github.com/song940/node-escpos', function(err){
this.cut();
this.close();
});
});
```

Here is the photo of the print:

![WhatsApp Image 2019-12-11 at 9 07 14 PM](https://user-images.githubusercontent.com/9060759/70636437-88be5c80-1c5b-11ea-8ee3-5e15bbb3988a.jpeg)

As you can see the words are broken on the right side if it extends the paper. My issue is with how the word breaks automatically to print the text. It seems like the css `word-break` property is at `break-all` mode.

Is there any way to change this behaviour so that instead of breaking the word, it will start printing from the next line?

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

Start with the default example and the chained .text(...) calls shown in the issue, reproducing the long English string on the target printer. Trace the text-printing path to determine how lines exceeding the paper width are handled; done means long words remain intact and continue on the next line instead of breaking at the paper edge.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.