diff --git a/lib/receipt_builder.rb b/lib/receipt_builder.rb index c5ac887..9e14db8 100644 --- a/lib/receipt_builder.rb +++ b/lib/receipt_builder.rb @@ -87,8 +87,10 @@ class ReceiptBuilder self end - # Native ESC/POS EAN-13 - def ean13(code) + # Native ESC/POS EAN-13. height is in dots (GS h) -- the printer's default + # (~162 dots) prints noticeably tall; 50 is a shorter, still-scannable size. + def ean13(code, height: 50) + @buffer << "\x1D\x68" << height.chr # GS h n -- set barcode height @buffer << "\x1D\x6B\x02" << code.b << "\x00" self end