receiptline / receiptline

Markdown for receipts. Printable digital receipts. Generate receipt printer commands and images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

more documentation

MDCservice opened this issue · comments

Dear receiptline / receiptio:

This project looks great. But as a non-node.js developer, it is difficult to get things running. A step-by-step example would be great.

I have a Epson TM-T88IV and a Star TSP100(USB version, not network version) here. I try to print on it with receiptline, but no success. I am using Ubuntu 20.04 on x86-64, the printers are on /dev/lp0 and /dev/lp1.

Could you guide me, how I can print on the Epson or Star with receiptline or receiptio? I have the designer running on localhost:8080, but I dont know where to enter the /dev/lp0 or lp1. Or even better, printing from the command line.

Thanks and Merry Christmas,

Thank you for using receiptline / receiptio.

Yesterday, we had our first meeting of the year and discussed about this issue.

1. receiptline

(1) Convert markdown to printer commands and write to a binary file

const fs = require('fs');
const receiptline = require('receiptline');

const text = fs.readFileSync('receipt.txt').toString().replace(/^\ufeff/, '');
const data = receiptline.transform(text, { command: 'escpos', cpl: 42, spacing: true });

fs.writeFileSync('receipt.prn', data, 'binary');

If the printer is printer class:

(2) Print with lpr

$ lpr -P TM-T88V-JPN -o raw receipt.prn

If the printer is a vendor class:

(2) Change permissons

$ sudo chmod 666 /dev/usb/lp0

(3) Write directly to the device file

$ cat receipt.prn > /dev/usb/lp0

or write directly in Node.js

//fs.writeFileSync('receipt.prn', data, 'binary');
fs.writeFileSync('/dev/usb/lp0', data, 'binary');

2. receiptio

receiptio does not currently support /dev/usb/lp*.
Because receiptio requires bidirectional communication for printer status.

So we need to convert the device file read/write to a duplex stream as a socket.
We are studying and will address this soon.

Thank you.

Hello!

We have just released ReceiptIO V1.1.0.
Epson TM-T88V and Star mC-Print3 connected via USB worked on Ubuntu 20.04.3 LTS.

$ receiptio -d /dev/usb/lp0 -p escpos -c 42 -l en example.txt

Thank you.

commented

For those who don't understand NODE.JS, they don't know how your code works at all.
Can you give a simple, detailed, and operational example? Thanks