Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more documentation #22

Open
MDCservice opened this issue Dec 23, 2021 · 3 comments
Open

more documentation #22

MDCservice opened this issue Dec 23, 2021 · 3 comments

Comments

@MDCservice
Copy link

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,

@receiptline
Copy link
Owner

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.

@receiptline
Copy link
Owner

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.

@cndck1
Copy link

cndck1 commented Mar 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants