
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.
receiptline
Advanced tools
Markdown for receipts. Printable digital receipts. Generate receipt printer commands and images.
Markdown for receipts. Printable digital receipts. 🧾
Generate receipt printer commands and images.
| Package | Type | For | Description |
|---|---|---|---|
| ReceiptLine | SDK for Node.js | Developers | Receipt description language processor |
| ReceiptIO | Node.js Console App | Users | Print, Convert, Printer status |
| Receipt.js | SDK for JavaScript | Developers | Receipt description language processor Print, Convert, Printer status |
| Receipt.js Designer | Tool | All | Edit, Preview, Print |
| QR Code Generator | Tool | All | Free QR Code Generator |
| ReceiptSharp | .NET Standard library | Developers | Receipt description language processor Print, Convert, Printer status |
| Receipt Markdown | VS Code Extension | All | Edit, Preview |
"ReceiptLine" is a coined word from "Receipt" and "Streamline".
Make it more efficient by making it simpler!



The reference implementation of the OFSC ReceiptLine Specification.
http://www.ofsc.or.jp/receiptline/en/
ReceiptLine is the receipt description language that expresses the output image of small roll paper.
It supports printing paper receipts using a receipt printer and displaying electronic receipts on a POS system or smartphone.
It can be described simply with receipt markdown text data that does not depend on the paper width.
This reference implementation also provides the development tool "ReceiptLine Designer" for editing, previewing, hex dumps with a virtual printer, and test printing on receipt printers.
Epson TM series (South Asia model) and Star MC series (StarPRNT model) can print with device font of Thai characters.

$ npm install receiptline
receiptline.transform() method transforms ReceiptLine document to printer commands or SVG images.
const receiptline = require('receiptline');
const doc = '{code:2012345678903;option:ean,hri}';
// printer example
const printer = {
cpl: 42,
encoding: 'multilingual',
upsideDown: false,
gamma: 1.8,
command: 'escpos'
};
const command = receiptline.transform(doc, printer);
// display example
const display = {
cpl: 42,
encoding: 'multilingual'
};
const svg = receiptline.transform(doc, display);
receiptline.transform(doc[, printer])
doc
printer
cpl
48)encoding
multilingual: Multilingual (including cp437, cp852, cp858, cp866, cp1252)cp437: United States (default)cp852: Central Europeancp858: Western Europeancp860: Portuguesecp863: French Canadiancp865: Nordiccp866: Cyrilliccp1252: Western Europeancp932: Japaneseshiftjis: Japanesecp936: Simplified Chinesegb18030: Simplified Chinesecp949: Koreanksc5601: Koreancp950: Traditional Chinesebig5: Traditional Chinesetis620: Thaigradient (for printer)
false: image processing for text, barcodes, and 2D codestrue: image processing for photos (default)gamma (for printer)
0.1 - 10.0, default: 1.8)threshold (for printer)
0 - 255, default: 128)upsideDown (for printer)
false: normal (default)true: upside downspacing
false: no line spacing (default)true: line spacingcutting (for printer)
false: no paper cuttingtrue: paper cutting (default)margin (for printer)
0 - 24, default: 0)marginRight (for printer)
0 - 24, default: 0)command
svg: SVG (default)text: plain textescpos: 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) Experimentalstarsbcs: StarPRNT (SBCS, Thai)starmbcs: StarPRNT (Japanese)starmbcs2: StarPRNT (Chinese, Korean)starlinesbcs: Star Line Mode (SBCS)starlinembcs: Star Line Mode (Japanese)starlinembcs2: Star Line Mode (Chinsese, Korean)emustarlinesbcs: Command Emulator Star Line Mode (SBCS)emustarlinembcs: Command Emulator Star Line Mode (Japanese)emustarlinembcs2: Command Emulator Star Line Mode (Chinsese, Korean)stargraphic: Star Graphic Mode (TSP100LAN)starimpact: 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) Experimentalreceiptline.barcode.generate() method generates a barcode.
receiptline.qrcode.generate() method generates a QR Code.
const bar = { data: '1234', type: 'code39', width: 2, quietZone: true };
const barform = receiptline.barcode.generate(bar);
const qr = { data: 'abcdefgh', level: 'm', quietZone: true };
const qrform = receiptline.qrcode.generate(qr);
receiptline.barcode.generate(symbol)
symbol <object>: barcode data
data <string>: data to encodetype <string>: barcode type
upc: UPC-A, UPC-E (check digit can be omitted)ean, jan: EAN-13, EAN-8 (check digit can be omitted)code39: CODE39itf: Interleaved 2 of 5codabar, nw7: Codabar (NW-7)code93: CODE93code128: CODE128code128width <number>: module width
2-42height <number>: module height
24-24072hri <boolean>: human readable interpretation
falsequietZone <boolean>: quiet zone
falselength <number>: barcode width (sum of widths)height <number>: barcode heightwidths <number[]>: bar / space width (quiet zone, bar, space, ... , bar, quiet zone)hri <boolean>: human readable interpretationtext <string>: human readable interpretation textreceiptline.qrcode.generate(symbol)
symbol <object>: QR Code data
data <string>: data to encodelevel <string>: error correction level
l: Lowm: Middleq: Quartileh: HighlquietZone <boolean>: quiet zone
false0: light1: darkQR Code is a registered trademark of DENSO WAVE INCORPORATED.
receiptline.createTransform() method is the stream version of the receiptline.transform().
const fs = require('fs');
const receiptline = require('receiptline');
const source = fs.createReadStream('example.receipt');
const transform = receiptline.createTransform({ command: 'svg' });
const destination = fs.createWriteStream('example.svg');
source.pipe(transform).pipe(destination);
receiptline.createTransform([printer])
printer
Display digital receipts in the web browser and print paper receipts on the printer as needed.
Print order slips from cloud server using Epson Server Direct Print or Star CloudPRNT.
Enter receipt markdown text from the web form, transform it to printer commands on the server, and print it out.
Enter receipt markdown text from the web form, transform it to SVG images on the web browser, and display it.
The documents (receipt markdown text) are the same as the examples in the OFSC ReceiptLine Specification.
Customize the command object to output your own commands.
It works on both web browser and Node.js.
To output printer commands on a web browser, use Receipt.js or Browserify.
$ browserify -o receiptline-full.js receiptline.js
Online version is available.
https://receiptline.github.io/designer/
The ReceiptLine Designer provides more features.

Copy the following files to your working directory
Start the server
$ node designer.js
Use a modern browser.
Configure printers.json
"printer_id": {
"host": "127.0.0.1",
"port": 19100,
"asImage": false,
"cpl": 48,
"encoding": "shiftjis",
"gradient": true,
"gamma": 1.8,
"threshold": 128,
"upsideDown": false,
"spacing": true,
"cutting": true,
"command": "escpos"
}
printer_id
host
port
9100)asImage
landscape
false: normal (default)true: landscape orientation (for escpos, epson, sii, citizen, starsbcs, starmbcs, starmbcs2)resolution
landscape (values: 180, 203, default: 203)cplencodinggradientgammathresholdupsideDownspacingcuttingmarginmarginRight
command
The designer can set initial values in the URL query string.
z: zoom (range: -5-5, default: 0)l: language (en, ja, ko, zh-hans, zh-hant, th, ...)c: characters per line (range: 24-96, default: 48)v: landscape (values: 0, 1, default: 0)s: line spacing (values: 0, 1, default: 0)p: printer identifier (alphanumeric or underscore characters)d: ReceiptLine documentThe serial-LAN converter enables test printing to USB / Bluetooth printers that support virtual serial ports.
Install the virtual serial port driver for the printer and Node Serialport
$ npm install serialport
Configure servers.json
"serial": {
"host": "127.0.0.1",
"port": 9100,
"device": "COM9"
}
serial
_serialhost
port
device
<system path>[:<options>]Serial port options
"device": "COM9:9600,N,8,1"
<options>
<baud rate>,<parity>,<data bits>,<stop bits>[,<flow control>]9600,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/xoffRestart the server
$ node designer.js
document

line

columns

column

text

char

escape

ws (whitespace)

property

member

key

value

The receipt is made of a table, which separates each column with a pipe |.
| Line | Content | Description |
|---|---|---|
column| column || columncolumn | | Text Property | Single column |
column | column | column | column || column | columncolumn | column | | Text | Double column |
column | ... | column| column | ... | column || column | ... | columncolumn | ... | column | | Text | Multiple columns |
The column is attracted to the pipe | like a magnet.
␣ means one or more whitespaces.
| Column | Description |
|---|---|
column|column||␣column␣| | Center |
|column|column␣|column ␣| | Left |
column||␣column||␣column | Right |
The text is valid for any column.
Asparagus | 0.99
Broccoli | 1.99
Carrot | 2.99
---
^TOTAL | ^5.97
Characters are printed in a monospace font (12 x 24 px).
Wide characters are twice as wide as Latin characters (24 x 24 px).
Control characters are ignored.
Special characters are assigned to characters that are rarely used in the receipt.
| Special character | Description |
|---|---|
\ | Character escape |
| | Column delimiter |
{ | Property delimiter (Start) |
} | Property delimiter (End) |
- (1 or more, exclusive) | Horizontal rule |
= (1 or more, exclusive) | Paper cut |
~ | Space |
_ | Underline |
" | Emphasis |
` | Invert |
^ | Double width |
^^ | Double height |
^^^ | 2x size |
^^^^ | 3x size |
^^^^^ | 4x size |
^^^^^^ | 5x size |
^^^^^^^ (7 or more) | 6x size |
Escape special characters.
| Escape sequence | Description |
|---|---|
\\ | \ |
\| | | |
\{ | { |
\} | } |
\- | - (Cancel horizontal rule) |
\= | = (Cancel paper cut) |
\~ | ~ |
\_ | _ |
\" | _ |
\` | ` |
\^ | ^ |
\n | Wrap text manually |
\xnn | Hexadecimal character code |
\char (Others) | Ignore |
The property is valid for lines with a single column.
{ width: * 10; comment: the column width is specified in characters }
| Key | Abbreviation | Value | Case-sensitive | Default | Saved | Description |
|---|---|---|---|---|---|---|
image | i | base64 png format | ✓ | - | - | Image (Recommended: monochrome, critical chunks only) |
code | c | textdata | ✓ | - | - | Barcode / 2D code |
option | o | see below | - | code128 2 72 nohri 3 l | ✓ | Barcode / 2D code options (Options are separated by commas or one or more whitespaces) |
align | a | leftcenterright | - | center | ✓ | Line alignment (Valid when line width < CPL) |
width | w | auto*0 - | - | auto( * for all columns) | ✓ | Column widths (chars) (Widths are separated by commas or one or more whitespaces) |
border | b | linespacenone0 - 2 | - | space | ✓ | Column border (chars) (Border width: line=1, space=1, none=0) |
text | t | wrapnowrap | - | wrap | ✓ | Text wrapping |
command | x | textdata | ✓ | - | - | Device-specific commands |
comment | _ | textdata | ✓ | - | - | Comment |
Barcode options are separated by commas or one or more whitespaces.
| Barcode option | Description |
|---|---|
upc | UPC-A, UPC-E (Check digit can be omitted) |
eanjan | EAN-13, EAN-8 (Check digit can be omitted) |
code39 | CODE39 |
itf | Interleaved 2 of 5 |
codabarnw7 | Codabar (NW-7) |
code93 | CODE93 |
code128 | CODE128 |
2 - 4 | Barcode module width (px) |
24 - 240 | Barcode module height (px) |
hri | With human readable interpretation |
nohri | Without human readable interpretation |
2D code options are separated by commas or one or more whitespaces.
| 2D code option | Description |
|---|---|
qrcode | QR Code |
3 - 8 | Cell size (px) |
lmqh | Error correction level |
Special characters in property values are different from special characters in text.
| Special character | Description |
|---|---|
\ | Character escape |
| | Column delimiter |
{ | Property delimiter (Start) |
} | Property delimiter (End) |
: | Key-value separator |
; | Key-value delimiter |
Escape special characters.
| Escape sequence | Description |
|---|---|
\\ | \ |
\| | | |
\{ | { |
\} | } |
\; | ; |
\n | New line |
\xnn | Hexadecimal character code |
\char (Others) | Ignore |
Open Foodservice System Consortium
http://www.ofsc.or.jp/
FAQs
Markdown for receipts. Printable digital receipts. Generate receipt printer commands and images.
The npm package receiptline receives a total of 14,085 weekly downloads. As such, receiptline popularity was classified as popular.
We found that receiptline 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.