This service allows you to discover Zebra printers and send/print ZPL templates by using HTTP POST requests.
- PrintZPL-win-x64 for Windows
- PrintZPL-linux-x64 for Linux
- PrintZPL-osx-x65 for MaxOS
- Create the service:
sc create MyServiceName ^
binPath= "C:\Full\Path\To\PrintZpl.exe" ^
DisplayName= "PrintZpl" ^
start= auto
- Start the service
sc start PrintZpl
You can send a GET request to http//localhost:9001/printers
Example response:
[
{
"name": "TestPrinter",
"ipAddress": "192.168.1.30",
"port": 9100,
"model": "ZebraTest"
}
]
You try sending a request to http://localhost:9001/print/from-zpl
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"
}
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.
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": "$"
}
]
}
- .NET 8 SDK
- dotnet build
dotnet run
This will start a web server on port 9001.
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\net8.0\win-x64\publish
(or the corresponding folder for your target platform).