Add Epson test page: text sizes, EAN-13, QR, and a raster image
deploy / deploy (push) Successful in 9s
deploy / deploy (push) Successful in 9s
ReceiptBuilder#image implements GS v 0 raster printing (no image library needed for the demo -- a procedural 8px checkerboard proves it end to end). Skipped attempting the printer's real-time clock: unsure the TM-T20II actually has a battery-backed RTC (that's usually an option on higher-end models), not worth guessing at an undocumented command.
This commit is contained in:
1 parent
790d716d57
commit
d2900361b3
3 files changed
+78
No files matched your search
@@ -93,6 +93,16 @@ class ReceiptBuilder
|
||||
self
|
||||
end
|
||||
|
||||
# Raster bit image (GS v 0) -- bytes must already be packed 1bpp,
|
||||
# row-major, (width_px/8 rounded up) bytes per row, MSB-first, 1=black.
|
||||
def image(width_px, height_px, bytes)
|
||||
width_bytes = (width_px + 7) / 8
|
||||
@buffer << "\x1D\x76\x30\x00"
|
||||
@buffer << [width_bytes % 256, width_bytes / 256, height_px % 256, height_px / 256].pack('C4')
|
||||
@buffer << bytes
|
||||
self
|
||||
end
|
||||
|
||||
def feed(lines = 3)
|
||||
@buffer << ("\n" * lines)
|
||||
self
|
||||
|
||||
Reference in new issue
Block a user