Skip to content

A ruby implementation of ESC/POS (thermal) printer image command specification.

Notifications You must be signed in to change notification settings

izzm/escpos-image

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Escpos-image

A ruby implementation of ESC/POS (thermal) printer image command specification.

Installation

Add this line to your application's Gemfile:

gem 'escpos-image'

And then execute:

$ bundle

Or install it yourself as:

$ gem install escpos-image

Examples

Usage

@printer = Escpos::Printer.new

image = Escpos::Image.new 'path/to/image.png'
# to use automatic conversion to monochrome format (requires mini_magick gem) use:
image = Escpos::Image.new 'path/to/image.png', {
  convert_to_monochrome: true,
  dither: true, # the default
  extent: true, # the default
}

@printer.write image.to_escpos

@printer.to_escpos # returns ESC/POS data ready to be sent to printer
# on linux this can be piped directly to /dev/usb/lp0
# with network printer sent directly to printer socket
# with serial port printer it can be sent directly to the serial port

@printer.to_base64 # returns base64 encoded ESC/POS data

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/escpos/escpos-image.

  1. Fork it ( https://github.com/escpos/escpos-image/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

A ruby implementation of ESC/POS (thermal) printer image command specification.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 98.9%
  • Shell 1.1%