Class: UDRS::Renderers::ESCPRenderer
- Defined in:
- lib/udrs/renderers/escp_renderer.rb,
lib/udrs/renderers/escp_renderer/font.rb,
lib/udrs/renderers/escp_renderer/line.rb,
lib/udrs/renderers/escp_renderer/table.rb
Overview
Tables
Constant Summary collapse
- NUL =
0.chr
- EOT =
4.chr
- ENQ =
5.chr
- HT =
9.chr
- LF =
10.chr
- FF =
12.chr
- CR =
13.chr
- DLE =
16.chr
- DC4 =
20.chr
- CAN =
24.chr
- ESC =
27.chr
- FS =
28.chr
- GS =
29.chr
- CHARACTER_MAP =
{ 'Ç' => "\x80", 'ü' => "\x81", 'é' => "\x82", 'â' => "\x83", 'ä' => "\x84", 'à' => "\x85", 'å' => "\x86", 'ç' => "\x87", 'ê' => "\x88", 'ë' => "\x89", 'è' => "\x8A", 'ï' => "\x8B", 'î' => "\x8C", 'ì' => "\x8D", 'Ä' => "\x8E", 'Å' => "\x8F", 'É' => "\x90", 'æ' => "\x91", 'Æ' => "\x92", 'ô' => "\x93", 'ö' => "\x94", 'ò' => "\x95", 'û' => "\x96", 'ù' => "\x97", 'ÿ' => "\x98", 'Ö' => "\x99", 'Ü' => "\x9A", 'ø' => "\x9B", '£' => "\x9C", 'Ø' => "\x9D", 'á' => "\xA0", 'í' => "\xA1", 'ó' => "\xA2", 'ú' => "\xA3", 'ñ' => "\xA4", 'Ñ' => "\xA5", 'ª' => "\xA6", 'º' => "\xA7", '¿' => "\xA8", '®' => "\xA9", '«' => "\xAE", '»' => "\xAF", '→' => "\xAF", 'Á' => "\xB5", 'Â' => "\xB6", 'À' => "\xB7", '©' => "\xB8", '¢' => "\xBD", 'ã' => "\xC6", 'Ã' => "\xC7", 'Ê' => "\xD2", 'Ë' => "\xD3", 'È' => "\xD4", '€' => "\xD5", 'Í' => "\xD6", 'Î' => "\xD7", 'Ï' => "\xD8", 'Ì' => "\xDE", 'Ó' => "\xE0", 'ß' => "\xE1", 'Ô' => "\xE2", 'Ò' => "\xE3", 'õ' => "\xE4", 'Õ' => "\xE5", 'Ú' => "\xE9", 'Û' => "\xEA", 'Ù' => "\xEB", 'ý' => "\xEC", 'Ý' => "\xED", }
- CODE_NUM =
The code num for PDF417
48
- CODE_SIZE =
3
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#render(container) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/udrs/renderers/escp_renderer.rb', line 99 def render(container) @buffer = '' @buffer << "#{ESC}@" # Re-init printer @buffer << "#{ESC}t#{19.chr}" # Reset character code table to PC858: Euro @buffer << "#{ESC}M#{1.chr}" # Set the font @buffer << "#{ESC}G#{0.chr}" # Set double-strike to off apply_font_size(:normal) apply_bold(false) apply_underline(:off) # Open the cash drawer @buffer << "#{ESC}p#{0.chr}#{100.chr}#{100.chr}" # Render the items @last_added = :page_end render_item(container) render_page_end(nil) # Replace special characters buffer = @buffer.dup CHARACTER_MAP.each do |char_orig, char_new| buffer.gsub!(char_orig, char_new) end return buffer end |