Skip to content

Service to send ZPL template to a Zebra label printer over TCP/IP. Supports data binding and batch printing.

License

Notifications You must be signed in to change notification settings

Tim-Maes/PrintZPL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrintZPL

Description

This service allows you to send ZPL templates to a Zebra printer by using HTTP POST requests.

Installation

Download and run as service

The API

You try sending a request to http://localhost:9001/print/from-zpl

For installation as a executable application, see instructions below.

Print ZPL Label

Using these parameters you can send a ZPL template to a printer:

{
    "ZPL": "^XA^FO50,50^ADN,36,20^FDHello, world!!^FS^XZ",
    "IpAddress": "0.0.0.0.0",
    "Port": "6101"
}

Print ZPL Label with data

You can also send data parameters to process a template that has placeholders for data and specify a delimiter.

For example, if you use the $ delimiter in your ZPL template, you can send the following request:

{
    "ZPL": "^XA^FO50,50^ADN,36,20^FD$Greeting$, $Name$!^FS^XZ",
    "IpAddress": "0.0.0.0.0",
    "Port": "6101",
    "Data": {
        "Greeting": "Hello",
        "Name": "World"
    },
    "Delimiter": "$"
}

$Greeting]$ and $Name$ will be replaced by Hello and World respectively.

Print ZPL Labels in batch

Url: http://localhost:9001/batch-print/from-zpl You can send a batch of ZPL templates to a printer by using the following request:

{
    "PrintRequests":
    [
        {
            "ZPL": "^XA^FO50,50^ADN,36,20^FDHello, $Name$!^FS^XZ",
            "IpAddress": "0.0.0.0.0",
            "Port": "6101",
            "Data": {
                "Name": "World",
                "Name2": "OtherValue"
            },
            "Delimiter": "$"
        },
        {
            "ZPL": "^XA^FO50,50^ADN,36,20^FDHello, $Name$!^FS^XZ",
            "IpAddress": "0.0.0.0.0",
            "Port": "6101",
            "Data": {
                "Name": "World",
                "Name2": "OtherValue"
            },
            "Delimiter": "$"
        }
    ]
}

The code

Building the project

Prerequisites

  • .NET 6 SDK
dotnet build

Running the project

dotnet run

This will start a web server on port 9001.

Pack this repo code as executable

Run this command in the project folder

Windows

dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true --self-contained true

Linux

dotnet publish -r linux-x64 -c Release /p:PublishSingleFile=true --self-contained true

MacOs

dotnet publish -r osx-x64 -c Release /p:PublishSingleFile=true --self-contained true

You'll find the output .exe in bin\Release\net6.0\win-x64\publish

About

Service to send ZPL template to a Zebra label printer over TCP/IP. Supports data binding and batch printing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages