
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Node.js printing application for receipt printers, simple and easy with receipt markdown, printer status support.
Node.js printing application for receipt printers, simple and easy with receipt markdown, printer status support.
$ more example.receipt
^^^RECEIPT
12/18/2021, 11:22:33 AM
Asparagus | 1| 1.00
Broccoli | 2| 2.00
Carrot | 3| 3.00
---
^TOTAL | ^6.00
$ receiptio -d 192.168.192.168 -c 42 example.receipt
success
const receiptio = require('receiptio');
const markdown = `^^^RECEIPT
12/18/2021, 11:22:33 AM
Asparagus | 1| 1.00
Broccoli | 2| 2.00
Carrot | 3| 3.00
---
^TOTAL | ^6.00`;
receiptio.print(markdown, '-d 192.168.192.168 -c 42').then(result => {
console.log(result);
});

ReceiptIO is a simple printing application for receipt printers that prints with easy markdown data for receipts and returns printer status. Even without a printer, it can output images.
ReceiptIO auto-detects printer models for seamless printing.
A development tool is provided to edit and preview the receipt markdown.
https://receiptline.github.io/receiptjs-designer/
The details of the receipt markdown are explained at
https://github.com/receiptline/receiptline
Connect with IP address, serial port, or Linux USB device file.
(LAN, Bluetooth SPP, USB with virtual serial port driver, ...)
Epson TM series (South Asia model) and Star MC series (StarPRNT model) can print with device font of Thai characters.
$ npm install -g receiptio
For USB connections on Linux, add a user to the lp group and reboot to access the device file.
$ sudo gpasswd -a USER lp
If serial port is used, Node SerialPort is also required.
$ npm install -g serialport
When using -i (print as image) or -p png (convert to png) option, puppeteer or sharp is also required.
$ npm install -g puppeteer
$ npm install -g sharp
sharp is not support web fonts and minimizes the area of "invert" character decoration.
$ receiptio -h
usage: receiptio [options] [source]
source:
receipt markdown text file
https://receiptline.github.io/designer/
if source is not present, standard input
options:
-h show help
-d <destination> ip address or serial/usb port of target printer
-o <outfile> file to output (if -d option is not present)
if -d and -o are not present, standard output
-q [<device>] inquire status (printer/drawer/drawer2) (default: printer)
-c <chars> characters per line (24-96) (default: 48)
-u upside down
-v landscape orientation (for escpos/epson/sii/citizen/star)
-r <dpi> print resolution for -v (180/203) (default: 203)
-s paper saving (reduce line spacing)
-n no paper cut
-m [<l>][,<r>] print margin (left: 0-24, right: 0-24) (default: 0,0)
-i print as image (requires puppeteer or sharp)
-b <threshold> image thresholding (0-255)
-g <gamma> image gamma correction (0.1-10.0) (default: 1.0)
-t <timeout> print timeout (0-3600 sec) (default: 300)
-l <language> language of source file (default: system locale)
(en/fr/de/es/po/it/ru/ja/ko/zh-hans/zh-hant/th/...)
-p <printer> printer control language (default: auto detection)
(escpos/epson/sii/citizen/fit/impact/impactb/generic/
star/starline/emustarline/stargraphic/
starimpact/starimpact2/starimpact3/svg/png/txt/text)
(png requires puppeteer or sharp)
print results:
success(0), online(100), coveropen(101), paperempty(102),
error(103), offline(104), disconnect(105), timeout(106),
drawerclosed(200), draweropen(201)
examples:
receiptio -d com9 -q
receiptio -d COM1 example.receipt
receiptio -d /dev/usb/lp0 example.receipt
receiptio -d /dev/ttyS0 -u -b 160 example.receipt
receiptio -d 192.168.192.168 -c 42 example.receipt
receiptio example.receipt -o receipt.png
receiptio example.receipt -o receipt.txt
receiptio example.receipt -p escpos -i -b 128 -g 1.8 -o receipt.prn
receiptio < example.receipt > receipt.svg
echo {c:1234567890} | receiptio | more
receiptio [options] [source]
source: receipt markdown text file
-d <destination>: ip address or serial/usb port of target printer-o <outfile>: file to output (if -d option is not found)-q [<device>]: inquire device status without printing
printer: printerdrawer: cash drawerdrawer2: cash drawer with state invertprinter-c <chars>: characters per line
24-9648-u: upside down-v: landscape orientation (for escpos, epson, sii, citizen, star)-r <dpi>: print resolution for -v
180, 203203-s: paper saving (reduce line spacing)-n: no paper cut-m [<left>][,<right>]: print margin
0-240-240,0-i: print as image (requires puppeteer or sharp)-b <threshold>: image thresholding
0-255-g <gamma>: image gamma correction
0.1-10.01.0-t <timeout>: print timeout (sec)
0-3600300-l <language>: language of receipt markdown text
en, fr, de, es, po, it, ru, ...: Multilingual (cp437, 852, 858, 866, 1252 characters)ja: Japanese (shiftjis characters)ko: Korean (ksc5601 characters)zh-hans: Simplified Chinese (gb18030 characters)zh-hant: Traditional Chinese (big5 characters)th: Thai-p <printer>: printer control language
escpos: ESC/POSepson: ESC/POS (Epson)sii: ESC/POS (Seiko Instruments)citizen: ESC/POS (Citizen)fit: ESC/POS (Fujitsu)impact: ESC/POS (TM-U220)impactb: ESC/POS (TM-U220 Font B)generic: ESC/POS (Generic) Experimentalstar: StarPRNTstarline: Star Line Modeemustarline: Command Emulator Star Line Modestargraphic: Star Graphic Modestarimpact: Star Mode on dot impact printers Experimentalstarimpact2: Star Mode on dot impact printers (Font 5x9 2P-1) Experimentalstarimpact3: Star Mode on dot impact printers (Font 5x9 3P-1) Experimentalsvg: SVGpng: PNG (requires puppeteer or sharp)txt: plain texttext: plain textepson, sii, citizen, fit, impactb, generic, star, svg, png, txt)-d option
success(0): printing successonline(100): printer is onlinecoveropen(101): printer cover is openpaperempty(102): no receipt papererror(103): printer error (except cover open and paper empty)offline(104): printer is off or offlinedisconnect(105): printer is not connectedtimeout(106): print timeoutdrawerclosed(200): drawer is closeddraweropen(201): drawer is open-d option
// async/await
const result = await receiptio.print(markdown, options);
console.log(result);
// promise
receiptio.print(markdown, options).then(result => {
console.log(result);
});
receiptio.print(markdown[, options])
markdown <string>
options <string>
-d <destination>: ip address or serial/usb port of target printer
-d option, the destination is the return value-q [<device>]: inquire device status without printing
printer: printerdrawer: cash drawerdrawer2: cash drawer with state invertprinter-c <chars>: characters per line
24-9648-m [<left>][,<right>]: print margin
0-240-240,0-u: upside down-v: landscape orientation (for escpos, epson, sii, citizen, star)-r <dpi>:print resolution for -v
180, 203203-s: paper saving (reduce line spacing)-n: no paper cut-i: print as image (requires puppeteer or sharp)-b <threshold>: image thresholding
0-255-g <gamma>: image gamma correction
0.1-10.01.0-t <timeout>: print timeout (sec)
0-3600300-l <language>: language of receipt markdown text
en, fr, de, es, po, it, ru, ...: Multilingual (cp437, 852, 858, 866, 1252 characters)ja: Japanese (shiftjis characters)ko: Korean (ksc5601 characters)zh-hans: Simplified Chinese (gb18030 characters)zh-hant: Traditional Chinese (big5 characters)th: Thai-p <printer>: printer control language
escpos: ESC/POSepson: ESC/POS (Epson)sii: ESC/POS (Seiko Instruments)citizen: ESC/POS (Citizen)fit: ESC/POS (Fujitsu)impact: ESC/POS (TM-U220)impactb: ESC/POS (TM-U220 Font B)generic: ESC/POS (Generic) Experimentalstar: StarPRNTstarline: Star Line Modeemustarline: Command Emulator Star Line Modestargraphic: Star Graphic Modestarimpact: Star Mode on dot impact printers Experimentalstarimpact2: Star Mode on dot impact printers (Font 5x9 2P-1) Experimentalstarimpact3: Star Mode on dot impact printers (Font 5x9 3P-1) Experimentalsvg: SVGpng: PNG (requires puppeteer or sharp)txt: plain texttext: plain textepson, sii, citizen, fit, impactb, generic, star, svg, png, txt)-d option <string>
success: printing successonline: printer is onlinecoveropen: printer cover is openpaperempty: no receipt papererror: printer error (except cover open and paper empty)offline: printer is off or offlinedisconnect: printer is not connectedtimeout: print timeoutdrawerclosed: drawer is closeddraweropen: drawer is open-d option <string>
receiptio.createPrint() method is the stream version of the receiptio.print().
const fs = require('fs');
const receiptio = require('receiptio');
const source = fs.createReadStream('example.receipt');
const transform = receiptio.createPrint('-p svg');
const destination = fs.createWriteStream('example.svg');
source.pipe(transform).pipe(destination);
receiptio.createPrint([options])
options <string>-d COM1:115200,N,8,1
-d <destination>
<system path>[:<options>]<options>
<baud rate>,<parity>,<data bits>,<stop bits>[,<flow control>]115200,N,8,1,N<baud rate>
2400, 4800, 9600, 19200, 38400, 57600, 115200<parity>
N: none, E: even, O: odd<data bits>
8, 7<stop bits>
1, 2<flow control>
N: none, R: rts/cts, X: xon/xoffFAQs
Node.js printing application for receipt printers, simple and easy with receipt markdown, printer status support.
We found that receiptio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.