Skip to content
/ a2_printer Public
forked from oesmith/a2_printer

A ruby gem for talking to a small thermal printer

Notifications You must be signed in to change notification settings

alx/a2_printer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A ruby gem for talking to a small thermal printer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%