Skip to content

REST-API / frontend to send ZPL/ZPLII to a zebra label printer

License

Notifications You must be signed in to change notification settings

mountain-branch/zpl-rest

 
 

Repository files navigation

take part in this little survey

zpl-rest

zpl-rest provides the following

  • REST-API to manage labels (written in ZPL), printer and to print these labels
  • a simple graphical user interface for this REST-API
  • you can use mustache in your ZPL-Code
  • you can preview the result of your ZPL-Code
  • you can test print your ZPL-Code
  • you can review and reprint printjobs
  • you can use placeholder in your ZPL labels (${varname}) which will be replaced through the API e.g.:
^XA
^LH0,0
^MTT
^A0N,36,36
^FO236,71
^FD${sometext}^FS
^XZ

which you can replace with the following POST-request to /rest/print:

{
    printer:"printer id",
    label:"id of the label",
    data : {
      sometext: "hello world"
    }
}

installation and start

download this repo und run npm start

frontend

  • overview page with statistics a screenshot of the frontend
  • reprint page, here you can print / review old printjobs a screenshot of the reprint page
  • label page, with label preview a screenshot of the frontend

REST-API

Method Path parameter description
get /rest/printer none list of all printers
get /rest/label none list of all labels
get /rest/jobs none list of all printjobs
get /rest/preview ?printer=printer_id&label=label_id(&zpl=...) generates a preview of the label using this service as base64
post /rest/print {printer:"printer_id...",label:"label_id...", data: {...}} actual print
post /rest/reprint/(:jobid) ({printer:"printer_id...", zpl:"..."}) reprint, change printer if wanted or ZPL-code
post /rest/preview {printer:"printer_id...",label:"label_id..."(,zpl:"...")} generates a preview of the label using this service as base64
post /rest/printer to add : {address:"..",name:"...",density:"..."} for update {_id:"...",address:"..",name:"...",density:"..."} add or update a printer
post /rest/label to add : {name:"...",zpl:"...",width:"...",height:"..."} for update {_id:"...",name:"...",zpl:"...",width:"...",height:"..."} add or update a label
delete /rest/printer/(:printerid) none removes a printer with the given id
delete /rest/label/(:labelid) none removes a label with the given id

options

you can edit the config.js with following options:

Option Type description Default
port int port for the RESTAPI 8000
websocket_port int websocket port for the frontend 8001
public bool if false server only reachable for localhost true
secret string the session secret

thanks to

template for the frontend

labelary for providing the preview service

a little help is welcome :)

Donate

About

REST-API / frontend to send ZPL/ZPLII to a zebra label printer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • EJS 51.4%
  • JavaScript 48.5%
  • Dockerfile 0.1%