Simple NodeJS Scripts to print beautiful layouts on your Adafruit/Sparkfun Thermalprinter.
🎨 Custom Layouts – Bypass layout limits
⚡️ React – Send from react-app with live-chat
🐘 Postgres – Connect to database and archive
The idea was simple: People should be able to send a message to a remote thermal printer hooked up to a raspberrypi. Since the built in layout capabilities of the thermal printer and its library are really limited, I wanted to enable things like custom Fonts, proper typography, svgs and more. The Input should be located on a react-app with a live chat displaying all sent messages, while the server should archive sent messages in a database.
This Repository is set up as a mono-repo containing the frontend, server and printer sources in three different folders.
$ cd server
$ yarn install
In order to archive all printed messages, the project is currently set to connect to a postgres database. I reccomend doing it locally for devleopment and playarround but you can also connect to a production database. You can change the settings for your development and production database in server/knexfile.js
. Edit your schema in server/migrations/schema
. For detailed documentation visit Knex. Spin up a Database and run
$ knex migrate:latest
If you need to know how to get a local database up and running, visit DockerHub–Postgres.
Super! Everything is set, lets start the Server by running
$ yarn start
Set your Server-IP in frontend/src/app.js:32
const s = io("000.000.0.00:8080");
$ cd frontend
$ yarn install
$ yarn start
Install node and npm on your RaspberryPi. Go to your raspi-config
and enable "Serial" under the Networking Options.
$ sudo raspi-config
Copy the "printer" folder to your RaspberryPi. And set your Server-IP in printer/print.js:9
const s = io("000.000.0.00:8080");
$ cd printer
$ npm install
$ npm start
If you want to edit the layout generated by the RaspberryPi, edit the file index.html located in printer/gen/
. You'll find css, js and html in one file.
Paramter | Origin |
---|---|
Date | Generated |
Message | Input Field |
Author | Input Field |
Code and Graphics by Leo Mühlfeld. This Project had its origins at the development of owe.zone. Original Idea & huge amount of help by Timo Lins! Demo Picture features Faune Typeface by Alice Savoie / Cnap.