@angadie/chittie-core
v0.5.1
Published
ESC/POS + StarLine/StarPRNT receipt encoder (builder API). Vendored from @point-of-sale/receipt-printer-encoder, MIT.
Readme
@angadie/chittie-core
The ESC/POS / StarLine / StarPRNT builder engine behind chittie — a ReceiptPrinterEncoder with a fluent API that produces Uint8Array printer bytes.
Vendored from
NielsLeenheer/ReceiptPrinterEncoder@939d303(MIT). We ship its ESM source directly (no build step) so it stays editable. SeeVENDOR.mdfor the snapshot/sync policy. Most apps use it via@angadie/chittie; install this directly only for the raw builder.
What we changed vs upstream
- Code-page dependency repointed to
@angadie/chittie-codepage. - A
structuredClonepolyfill guard (in oursrc/index.js, not the vendored algorithm) for older Hermes / React Native. @canvas/image-datapinned≥1.1.0(itsreact-nativeentry — needed forimage()on RN).
Install
pnpm add @angadie/chittie-coreUsage
import ReceiptPrinterEncoder from '@angadie/chittie-core';
const bytes = new ReceiptPrinterEncoder({ columns: 48 })
.initialize()
.align('center').bold(true).line('Artisan Haus').bold(false)
.rule()
.table(
[{ width: 36, align: 'left' }, { width: 12, align: 'right' }],
[['Flat White', 'Rs. 850']]
)
.barcode('012345678905', 'ean13', 60)
.qrcode('https://example.lk')
.pulse() // cash drawer
.cut()
.encode(); // Uint8ArrayKey methods: initialize, text, line, newline, bold, underline, invert, align, size, font, table, rule, box, barcode, qrcode, pdf417, image, pulse, cut, raw, encode. Full reference: the upstream docs (this is a faithful snapshot).
Non-Latin scripts
text() uses code pages, so Sinhala/Tamil become ?. Use @angadie/chittie-text to detect and rasterize them via image().
License
MIT — retains the upstream copyright (see LICENSE).
