lsongdev / lsongdev/node-escpos

Error: Port is opening; some other problems

Aperta
#330 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
TypeScript
Stelle
1.6k
Fork
443
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I using this package with:

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

My code:

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo printSerial con la chiamata device.open mostrata e la configurazione della stampante seriale COM2. Verifica l’errore segnalato “Port is opening” confermando che la stampa continui a funzionare, quindi verifica separatamente i problemi di codifica e formattazione mostrati; il lavoro è completato quando il comportamento della porta e ogni problema di output segnalato hanno una risoluzione chiara e testata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
electron, javascript, nodejs
Ambito
desktop, embedded-iot
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.