Module: Escpos

Defined in:
lib/escpos.rb,
lib/escpos/report.rb,
lib/escpos/helpers.rb,
lib/escpos/printer.rb,
lib/escpos/version.rb

Defined Under Namespace

Modules: Helpers Classes: Printer, Report

Constant Summary collapse

HW_INIT =

Printer hardware

[ 0x1b, 0x40 ]
HW_SELECT =

Printer select

[ 0x1b, 0x3d, 0x01 ]
HW_RESET =

Reset printer hardware

[ 0x1b, 0x3f, 0x0a, 0x00 ]
CTL_LF =

Feed control sequences

[ 0x0a ]
CTL_FF =

Form feed

[ 0x0c ]
CTL_CR =

Carriage return

[ 0x0d ]
CTL_HT =

Horizontal tab

[ 0x09 ]
CTL_VT =

Vertical tab

[ 0x0b ]
PAPER_FULL_CUT =

Paper

[ 0x1d, 0x56, 0x00 ]
PAPER_PARTIAL_CUT =

Partial paper cut

[ 0x1d, 0x56, 0x01 ]
PAPER_CUT_A =

Paper cut A

[ 0x1d, 0x56, 0x41 ]
PAPER_CUT_B =

Paper cut B

[ 0x1d, 0x56, 0x42 ]
CD_KICK_2 =

Cash Drawer

[ 0x1b, 0x70, 0x00 ]
CD_KICK_5 =

Send pulse to pin 5

[ 0x1b, 0x70, 0x01 ]
CP_SET =

Code Pages

[ 0x1b, 0x74 ]
CP_CP437 =
[ 0x0 ]
CP_CP850 =
[ 0x2 ]
CP_CP860 =
[ 0x3 ]
CP_CP863 =
[ 0x4 ]
CP_CP865 =
[ 0x5 ]
CP_CP1251 =
[ 0x6 ]
CP_CP866 =
[ 0x7 ]
CP_MACCYRILLIC =
[ 0x8 ]
CP_CP775 =
[ 0x9 ]
CP_CP1253 =
[ 0x10 ]
CP_CP737 =
[ 0x11 ]
CP_CP857 =
[ 0x12 ]
CP_ISO8859_9 =
[ 0x13 ]
CP_CP864 =
[ 0x14 ]
CP_CP862 =
[ 0x15 ]
CP_ISO8859_2 =
[ 0x16 ]
CP_CP1253_ALT =
[ 0x17 ]
CP_CP1250 =
[ 0x18 ]
CP_CP858 =
[ 0x19 ]
CP_CP1254 =
[ 0x20 ]
CP_CP737_ALT =
[ 0x24 ]
CP_CP1257 =
[ 0x25 ]
CP_CP847 =
[ 0x26 ]
CP_CP885 =
[ 0x28 ]
CP_CP857_ALT =
[ 0x29 ]
CP_CP1250_ALT =
[ 0x30 ]
CP_CP775_ALT =
[ 0x31 ]
CP_CP1254_ALT =
[ 0x32 ]
CP_CP1256 =
[ 0x34 ]
CP_CP1258 =
[ 0x35 ]
CP_ISO8859_2_ALT =
[ 0x36 ]
CP_ISO8859_3 =
[ 0x37 ]
CP_ISO8859_4 =
[ 0x38 ]
CP_ISO8859_5 =
[ 0x39 ]
CP_ISO8859_6 =
[ 0x40 ]
CP_ISO8859_7 =
[ 0x41 ]
CP_ISO8859_8 =
[ 0x42 ]
CP_ISO8859_9_ALT =
[ 0x43 ]
CP_ISO8859_15 =
[ 0x44 ]
CP_CP856 =
[ 0x47 ]
CP_CP874 =
[ 0x47 ]
TXT_NORMAL =

Text formating

[ 0x1b, 0x21, 0x00 ]
TXT_2HEIGHT =

Double height text

[ 0x1b, 0x21, 0x10 ]
TXT_2WIDTH =

Double width text

[ 0x1b, 0x21, 0x20 ]
TXT_4SQUARE =

Quad area text

[ 0x1b, 0x21, 0x30 ]
TXT_UNDERL_OFF =

Underline font OFF

[ 0x1b, 0x2d, 0x00 ]
TXT_UNDERL_ON =

Underline font 1

[ 0x1b, 0x2d, 0x01 ]
TXT_UNDERL2_ON =

Underline font 2

[ 0x1b, 0x2d, 0x02 ]
TXT_BOLD_OFF =

Bold font OFF

[ 0x1b, 0x45, 0x00 ]
TXT_BOLD_ON =

Bold font ON

[ 0x1b, 0x45, 0x01 ]
TXT_FONT_A =

Font type A

[ 0x1b, 0x4d, 0x00 ]
TXT_FONT_B =

Font type B

[ 0x1b, 0x4d, 0x01 ]
TXT_ALIGN_LT =

Left justification

[ 0x1b, 0x61, 0x00 ]
TXT_ALIGN_CT =

Centering

[ 0x1b, 0x61, 0x01 ]
TXT_ALIGN_RT =

Right justification

[ 0x1b, 0x61, 0x02 ]
TXT_INVERT_ON =

Inverted color text

[ 0x1d, 0x42, 0x01 ]
TXT_INVERT_OFF =

Inverted color text

[ 0x1d, 0x42, 0x00 ]
TXT_COLOR_BLACK =

Default Color

[ 0x1b, 0x72, 0x00 ]
TXT_COLOR_RED =

Alternative Color (Usually Red)

[ 0x1b, 0x72, 0x01 ]
BARCODE_TXT_OFF =

Barcodes

[ 0x1d, 0x48, 0x00 ]
BARCODE_TXT_ABV =

HRI barcode chars above

[ 0x1d, 0x48, 0x01 ]
BARCODE_TXT_BLW =

HRI barcode chars below

[ 0x1d, 0x48, 0x02 ]
BARCODE_TXT_BTH =

HRI barcode chars both above and below

[ 0x1d, 0x48, 0x03 ]
BARCODE_FONT_A =

Font type A for HRI barcode chars

[ 0x1d, 0x66, 0x00 ]
BARCODE_FONT_B =

Font type B for HRI barcode chars

[ 0x1d, 0x66, 0x01 ]
BARCODE_HEIGHT =

Barcode Height (1 - 255)

[ 0x1d, 0x68 ]
BARCODE_WIDTH =

Barcode Width (2 - 6)

[ 0x1d, 0x77 ]
BARCODE_UPC_A =

Barcode type UPC-A

[ 0x1d, 0x6b, 0x00 ]
BARCODE_UPC_E =

Barcode type UPC-E

[ 0x1d, 0x6b, 0x01 ]
BARCODE_EAN13 =

Barcode type EAN13

[ 0x1d, 0x6b, 0x02 ]
BARCODE_EAN8 =

Barcode type EAN8

[ 0x1d, 0x6b, 0x03 ]
BARCODE_CODE39 =

Barcode type CODE39

[ 0x1d, 0x6b, 0x04 ]
BARCODE_ITF =

Barcode type ITF

[ 0x1d, 0x6b, 0x05 ]
BARCODE_NW7 =

Barcode type NW7

[ 0x1d, 0x6b, 0x06 ]
VERSION =
"0.0.10"

Class Method Summary collapse

Class Method Details

.sequence(*arr_sequence) ⇒ Object

Transforms an array of codes into a string



112
113
114
# File 'lib/escpos.rb', line 112

def sequence(*arr_sequence)
  arr_sequence.flatten.pack('U*')
end