Code Monkey home page Code Monkey logo

zpl-rest's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.