Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A ruby gem for talking to a small thermal printer
Ruby
branch: master

This branch is 4 commits ahead, 5 commits behind lazyatom:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
Gemfile
README.md
Rakefile
a2_printer.gemspec
print_from_file.rb
test.rb

README.md

a2 printer

A simple library for formatting data for thermal receipt printers.

example

require 'net/http'
require 'uri'

require 'a2_printer'

data = StringIO.new
printer = A2Printer.new(data)
printer.begin
printer.set_default
# print text
printer.println("Visit Wildfire!")
# print a QR code
printer.qrcode('http://wildfireapp.com')

uri = URI.parse('http://olly.oesmith.co.uk:4567/printer/{PRINTER ID HERE}')
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.path)
request['content-type'] = 'application/data'
request.body = data.string
response = http.request(request)
puts response if response.code != 200
Something went wrong with that request. Please try again.