From f8857384fdad82b0eb9093ae9048784f150e7f1c Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Sun, 13 Sep 2026 12:12:28 +0200 Subject: [PATCH] Shorten default barcode height -- printer default (~162 dots) prints noticeably tall --- lib/receipt_builder.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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