lsongdev / lsongdev/node-escpos
How to print the text from the next line, if the word extends the paper?
Nobody has claimed this yet.
- 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:

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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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