Project

a2_printer

0.01
No commit activity in last 3 years
No release in over 3 years
Sending commands to a small thermal printer
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

~> 1.0.4
 Project Readme

A2 Printer

A small library for working with cheap thermal "A2" printers, such as those available from Adafruit and Sparkfun.

Simple example

serial_connection = SerialConnection.new("/dev/serial")
printer = A2Printer.new(serial_connection)

printer.begin
printer.println("Hello world!")
printer.feed
printer.bold_on
printer.println("BOOM!")
printer.bold_off

Writing to a file

This can be useful if you're going to use some other mechanism to send the bytes to the printer

commands_file = File.open("serial_commands.data", "w")
printer = A2Printer.new(commands_file)
printer.begin
printer.println("Hello world!")

# etc ...

commands_file.close