# thermalprinter

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

Latest version **0.3.10** (published 2021-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install thermalprinter
pnpm add thermalprinter
yarn add thermalprinter
bun add thermalprinter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.10 |
| Published | 2021-07-09 |
| First published | 2014-05-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 20.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 104 |
| Author | Xavier Seignard |
| Maintainers | xavier.seignard |
| Keywords | adafruit, printer, thermal, serialport |

## Links

- npm: https://www.npmjs.com/package/thermalprinter
- Repository: https://github.com/xseignard/thermalPrinter
- Issues: https://github.com/xseignard/thermalPrinter/issues
- npm.io page: https://npm.io/package/thermalprinter

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^1.5.0
- [deasync](https://npm.io/package/deasync.md) ^0.1.3
- [get-pixels](https://npm.io/package/get-pixels.md) ^3.2.3

## Recent versions

- 0.3.10 (latest) — 2021-07-09
- 0.3.9 — 2021-07-09
- 0.3.8 — 2016-01-06
- 0.3.7 — 2015-11-30
- 0.3.5 — 2015-11-23
- 0.3.4 — 2015-11-15
- 0.3.3 — 2015-11-15
- 0.3.2 — 2015-11-15
- 0.3.1 — 2015-11-10
- 0.3.0 — 2015-10-15
- 0.2.0 — 2015-03-30
- 0.1.0 — 2014-09-15
- 0.0.5 — 2014-06-01
- 0.0.3 — 2014-06-01
- 0.0.2 — 2014-05-30
- … 1 more at https://npm.io/package/thermalprinter/versions

## README

# Control the Adafruit/Sparkfun thermal printer from node.js

[![npm](https://img.shields.io/npm/v/thermalprinter.svg?style=flat-square)](https://www.npmjs.com/package/thermalprinter) [![Travis](https://img.shields.io/travis/xseignard/thermalPrinter.svg?style=flat-square)](https://travis-ci.org/xseignard/thermalPrinter) [![Code Climate](https://img.shields.io/codeclimate/coverage/github/xseignard/thermalPrinter.svg?style=flat-square)](https://codeclimate.com/github/xseignard/thermalPrinter/coverage)

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](/images/schema.png)


## Usage
- install with `npm install thermalprinter --save` 
- check the demo sample:

```js
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](/images/demo.gif)

---
_Source: https://npm.io/package/thermalprinter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
