Ever wanted to upload a PDF from your web app and just print it? Here's the solution ;)
- Clone the repo
yarn
- Edit the
.env
file. (See below for details) yarn run build
yarn start
PRINTER_NAME=<THE_NAME_OF_YOUR_PRINTER> (or delete the key completely to use your 'default' printer)
PORT=<PORT> (Default is 3000, change it as you wish)
curl --location --request POST 'http://localhost:3000/print' \
--form 'pdf=@<path_to_file>'
I've only tested it on a Linux system (Ubuntu), and most probably it won't work on Windows. Also, it won't run (at least out of the box) on Docker.
Thanks to @thiagoelg for maintaining the npm module to interface with the printer.