lsongdev / lsongdev/node-escpos
Error: Port is opening; some other problems
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 443
- PR merge metrics
- No merged PRs in 30d
Description
I using this package with:
- electron: `^11.1.1`
- escpos: `^3.0.0-alpha.6`
- escpos-serialport: `^3.0.0-alpha.4`
My code:
```js
const escpos = require('escpos');
escpos.SerialPort = require('escpos-serialport');
module.exports = {
printSerial: function(port){
let device = new escpos.SerialPort('COM2', { baudRate: 19200 });
let printer = new escpos.Printer(device);
device.open(function(err){
console.log('== Err ==', err);
printer
.size(1, 1)
.encode('EUC-KR')
.align('CT')
.text('혼밥대왕')
.align('LT')
.tableCustom([
{ text: 'Date:', width: 0.4 },
{ text: '2021-01-04 11:11', width: 0.6 }
])
.tableCustom([
{ text: 'Order ID:', width: 0.4 },
{ text: '050-7866-2406', width: 0.6 }
])
.tableCustom([
{ text: '전화번호:', width: 0.4 },
{ text: '200000000', width: 0.6 }
])
.tableCustom([
{ text: '메모:', width: 0.4 },
{ text: '문앞에 두고 벨을 눌러주세요', width: 0.6 }
])
.newLine()
.text('기사님 이름:')
.text('기사님 번호:')
.newLine()
.tableCustom([
{ text: '내부규', width: 0.33, align: 'LEFT' },
{ text: '내부', width: 0.33, align: 'CENTER' },
{ text: '율과', width: 0.33, align: 'CENTER' }
])
.tableCustom([
{ text: '내부규율과', width: 0.33, align: 'LEFT' },
{ text: '1', width: 0.33, align: 'CENTER' },
{ text: '2,000,000 원', width: 0.33, align: 'CENTER' }
])
.newLine()
.tableCustom([
{ text: '합계', width: 0.6, align: 'LEFT' },
{ text: '2,000,000 원', width: 0.4, align: 'RIGHT' }
])
.tableCustom([
{ text: '배송료(11.2km)', width: 0.6, align: 'LEFT' },
{ text: '2,000 원', width: 0.4, align: 'RIGHT' }
])
.tableCustom([
{ text: '수수료', width: 0.6, align: 'LEFT' },
{ text: '-0 원', width: 0.4, align: 'RIGHT' }
])
.newLine()
.tableCustom([
{ text: '총금액', width: 0.6, align: 'LEFT' },
{ text: '2,000,000 원', width: 0.4, align: 'RIGHT' }
])
.newLine()
.cut();
setTimeout(function(){
printer.close();
}, 1000);
});
}
};
```
When I call `printSerial` method, has error
```
== Err == Error: Port is opening
```
But printer still normal print.
Some other problems
- text has black background,
- It cannot show Korea text.
- How to print dotted line
Thank advance so much for help
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 by reproducing printSerial with the shown device.open call and the COM2 serial printer configuration. Check the reported “Port is opening” error while confirming that printing still works, then separately verify the shown encoding and formatting concerns; done means the port behavior and each reported output problem have a clear, tested resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, javascript, nodejs
- Domain
- desktop, embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100