Skip to content

crbnos/zpl-print

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZPL Print Server

A simple web server built with Hono.js that handles ZPL print requests.

sequenceDiagram
    participant W as Web App
    participant N as Ngrok Endpoint
    participant L as Local Print Server
    participant P as Network Printer
    
    W->>N: Trigger Event
    N->>L: Forward Request
    L->>W: Request ZPL Download
    W-->>L: Send ZPL Data
    L->>P: Send Print Job
    P-->>L: Print Confirmation
Loading

Setup

  1. Install dependencies:

    npm install
    
  2. Start the server:

    npm start
    

    For development with auto-restart:

    npm run dev
    
  3. Expose via ngrok

    ngrok http 4321
    
  4. Define the printers and work centers in /src/config.ts

API Endpoints

POST /print

Accepts a print request with ZPL callback URL and optional work center ID.

Request Body:

{
  "url": "https://example.com/zpl-data",
  "workCenterId": "WC123" // Optional
}

You can also send raw ZPL:

{
  "zpl": "^XA^FX Top section with logo, name and address.^CF0,60^FO50,50^GB100,100,100^FS^FO75,75^FR^GB100,100,100^FS^FO93,93^GB40,40,40^FS^FO220,50^FDIntershipping, Inc.^FS^CF0,30^FO220,115^FD1000 Shipping Lane^FS^FO220,155^FDShelbyville TN 38102^FS^FO220,195^FDUnited States (USA)^FS^FO50,250^GB700,3,3^FS^XZ"
}

Example Usage

Using curl:

curl -X POST http://localhost:4321/print \
  -H "Content-Type: application/json" \
  -d '{"url": "https://localhost:3000/file/receipt/cv7ms3i2i0l4uedgh390/labels.zpl", "workCenterId": "1"}'

About

A local webserver for printing ZPL labels remotely via ngrok

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors