This is a hapi server proving print services to https://github.com/AMPATH/ng-amrs The server uses lpr (http://www.cups.org/documentation.php/options.html) cups command to print pdfs generated by https://github.com/GNOME/glabels (Be sure to compile from source the one provides by ubuntu lacks glabels-3-batch ) you can run
$ glabels-3-batch labelwithname.glabels --input=file.csv --output=out.pdf
this outputs a pdf out.pdf then run
$ lpr out.pdf
You can run
lpstat -p | grep -v off | grep -v paused | grep -v disabled | grep -v directory | grep -v 'ready to print' |sed 's/is idle.*//' | cut -d " " -f2-
to get the names of printers that are ready to accept jobs this will return something like (This works but maybe there is a better way)
DYMO_LabelWriter_450_Turbo
HP_LaserJet_Pro_MFP_M125nw
......etc
you can then run the command above with
lpr DYMO_LabelWriter_450_Turbo out.pdf
To explicitly print to DYMO_LabelWriter_450_Turbo
to print with your default cups printer.If that is okay then run
$ npm install
to fetch dependencies and then
$ npm start
Currently the server expects a json payload similar to
{
"template":"labelwithname",
"printer":"Brother_QL-710W",
"mergeData": [
{
"first_name": "Emmanuel",
"last_name": "Nyachoke",
"middle_name": "A",
"identifier": "473305528-1",
"gender": "male"
}
]}
The order of the fields is important this will then create a CSV
"Emmanuel","Nyachoke","A","473305528-1","male"
meaning in glabels
key 1 = Emmanuel
key 2 = Nyachoke
key 3 = A
key 4 = 473305528-1
key 5 = male
You can the bind them to your label in glabels like
${1}
Instead of the text for the particular widget
The file labelwithname.glabels
is a label template for Dymo 999010 Address labels 28.575mm X 88.9mm
This template will work just fine with Brother DK 29mmX90.3mm
labels you can jst design on the this printer with glabels