xseignard/thermalPrinter


Use node.js to communicate with Adafruit/Sparkfun Thermal Printer

Language: JavaScript


Control the Adafruit/Sparkfun thermal printer from node.js

npm Travis Code Climate

Largely inspired by http://electronicfields.wordpress.com/2011/09/29/thermal-printer-dot-net/

You can print images, but they need to be 384px wide.

It's a fluent API, so you can chain functions, but don't forget to call print at the end to actually print something!

Crappy schematics

You'll need an USB/Serial converter.

schematics

Usage

  • install with npm install thermalprinter --save
  • check the demo sample:
var SerialPort = require('serialport'),
	serialPort = new SerialPort('/dev/ttyUSB0', {
		baudrate: 19200
	}),
	Printer = require('thermalprinter');

var path = __dirname   '/images/nodebot.png';

serialPort.on('open',function() {
	var printer = new Printer(serialPort);
	printer.on('ready', function() {
		printer
			.indent(10)
			.horizontalLine(16)
			.bold(true)
			.indent(10)
			.printLine('first line')
			.bold(false)
			.inverse(true)
			.big(true)
			.right()
			.printLine('second line')
			.printImage(path)
			.print(function() {
				console.log('done');
				process.exit();
			});
	});
});

Demo

demo

Project Statistics

Sourcerank 7
Repository Size 3.1 MB
Stars 102
Forks 33
Watchers 8
Open issues 9
Dependencies 10
Contributors 7
Tags 17
Created
Last updated
Last pushed

Top Contributors See all

Xavier Seignard Flurin Egger Lionel RADISSON Jonathan Berger Linus Unnebäck qwazwsx Paul Hayes

Packages Referencing this Repo

thermalprinter
Use node.js to communicate with Adafruit/Sparkfun Thermal Printer
Latest release 0.3.10 - Updated - 102 stars

Recent Tags See all

v0.3.10 July 09, 2021
v0.3.9 July 09, 2021
v0.3.8 January 06, 2016
v0.3.7 November 30, 2015
v0.3.6 November 30, 2015
v0.3.5 November 23, 2015
v0.3.4 November 15, 2015
v0.3.3 November 15, 2015
v0.3.2 November 15, 2015
v0.3.1 November 10, 2015
v0.3.0 October 15, 2015
v0.2.0 March 30, 2015
v0.1.0 September 15, 2014
v0.0.5 June 01, 2014
v0.0.4 June 01, 2014

Interesting Forks See all

zaccolley/tessel-thermalprinter
Thermal printer module for Tessel
This repository is no longer available - 6 stars

Something wrong with this page? Make a suggestion

Last synced: 2021-07-09 07:00:42 UTC

Login to resync this repository