Skip to content

Repository files navigation

Printrz

Printrz is a bridge between web app and printers installed on the OS. It was originally built to send raw ESC/POS commands to thermal printers from a web point of sale but this project can answer other purposes (see API doc for more).

Introduction

The initial purpose of this application was to send ESC/POS commands to thermal printers from a web app. Since the API implements the lovely (♥) node-printer project, the API can theorically be used to print PDF, JPG and whatsoever.

Currently, this app is used by GUIDAP's customers to print cash receipt from a desktop device.

Roadmap to v1

  • Fix auto update (since v0.1.1)
  • Sign app binaries
  • Add "Reload printers" button (#3)
  • Show printer state and indicate the default printer of the OS
  • Server settings page (host, port) (#6)
  • Show local IP on server settings page (#4)
  • Add API Documentation page
  • Add self-signed certificates generation for HTTPS origin support (#6)
  • Allow the user to override the default printer
  • Allow the user to chose the best print test between ESC/POS, JPG, PDF and plain text
  • Unit and fonctional testing
  • Create a fancy logo

Roadmap to v2

  • Separate Electron app and API to different projects (the API could be useful as a standalone command line tool)

How to use

Install the latest release of Printrz on your favorite operating system.

Open this JSFiddle and try yourself !

macOS installation

The app is currently not signed nor notarized with an Apple Developer ID. As a result, when you download the DMG and install Printrz on a Mac that did not build it, macOS Gatekeeper blocks the launch with a message like "Printrz is damaged and can't be opened" or "unidentified developer".

This happens because macOS automatically tags files downloaded from the internet (or transferred via AirDrop, USB, etc.) with a com.apple.quarantine extended attribute, which Gatekeeper then refuses to validate without a signature.

To bypass this, after installing the app into /Applications, run the following command in the Terminal:

xattr -cr /Applications/Printrz.app

This removes the quarantine attribute and allows the app to launch normally. You only need to run it once per installation.

Note: this is a temporary workaround. The proper fix is to sign and notarize the app — see the "Sign app binaries" item in the roadmap above.

API

Route Method Description
/ GET Server healthcheck endpoint.
/printers GET Get the list of installed printers.
/job POST Send a print job to a specific printer.

See API.md for the full reference (request/response shapes, examples, TLS notes, error codes).

Contribute

Follow the guidelines exposed in the CONTRIBUTING file.

How to develop

Prerequisites

You have to install Node (LTS) and Yarn.

Windows users

Install Python (executable installer).

Follow this tutorial to know the Python executable path.

Open the Node Prompt as administrator and run the following command :

set PYTHON=C:\Users\...\AppData\Local\Programs\Python\Python37\python.exe # Change with your own Path
npm install --global --production windows-build-tools@4.0.0
yarn config set msvs_version 2017
set GYP_MSVS_VERSION=2017

Build Setup

# install dependencies
$ yarn

# serve with hot reload at localhost:9080
$ yarn dev

# Build (only) electron application for production
# On windows:
$ yarn build --win
# On macOS Intel:
$ yarn build --macos --x64
# On macOS Apple Silicon:
$ yarn build --macos --arm64
# On Debian/Ubuntu:
$ yarn build --linux

# Build and release electron application for production
# We have to create a new tag first
$ yarn version # set the <new version>
$ git tag <new version>
$ git push && git push --tags
# On windows:
$ yarn release --win
# On macOS Intel:
$ yarn release --macos --x64
# On macOS Apple Silicon:
$ yarn release --macos --arm64
# On Debian/Ubuntu:
$ yarn release --linux

# run unit tests
$ yarn test

# lint all JS/Vue component files in `src/`
$ yarn lint

Special thanks

To @tojocky with his node-printer project ❤️.

This project was generated with electron-vue using vue-cli. Documentation about the original structure can be found here.

About

A bridge used to talk with printers using raw commands (esc/pos 100% compatible)

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages