ZPLPrinter Web API for Docker allows you to Convert, Preview and Render raw ZPL (Zebra Programming Language) commands to well known image and document formats like PNG, JPG, PDF, PCX, Zebra GRF ASCII hex, Zebra EPL Binary Graphic, Honeywell-Intermec FingerPrint Binary Graphic, EPSON ESC/POS NV Binary Graphic & HP PCL Binary Graphic from Any Development Platform and Programming Languages (.NET, Java, PHP, Javascript, Python, Ruby, and more!)
Designed by following some of the REST principles, ZPLPrinter Web API for Docker responds to a simple HTTP POST by specifying the ZPL commands and printer settings through a JSON object in the request body, returning the output rendering in the image or document format specified through the Accept header.
ZPLPrinter Web API for Docker is available at Docker Hub registry.
To pull/download the Docker image, please type the following from a Terminal:
AMDTo run the Docker image, please type the following from a Terminal:
AMDBy default, our Docker image exposes ports 80
and 443
only. If you want to expose and use another different port, then do the following.
12345
. Create a new Dockerfile and edit it by pasting the following content:
FROM neodynamic/zplprinterwebapi:5.0.10
EXPOSE 12345
The following source code invokes the ZPLPrinter Web API for Docker to generate a PNG image for the specified ZPL Commands. For more advanced settings please refer to the ZPLPrintJob JSON Object
curl -X POST "http://localhost:8080/ZPLPrinter" \
-H "Accept: image/png" \
-H "Content-Type: application/json" \
-d "{\"zplCommands\":\"^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ\"}" \
--output label.png
$data = array(
'zplCommands' => '^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ'
);
$options = array(
'http' => array(
'method' => 'POST',
'content' => json_encode( $data ),
'header' => "Content-Type: application/json\r\n" .
"Accept: image/png\r\n"
)
);
$context = stream_context_create( $options );
$url = 'http://localhost:8080/ZPLPrinter';
$response = file_get_contents( $url, false, $context );
file_put_contents('label.png', $response);
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("http://localhost:8080/ZPLPrinter")
header = {'Accept':'image/png', 'Content-Type': 'application/json'}
data = {zplCommands: '^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ'}
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = data.to_json
response = http.request(request)
open('/tmp/label.png', 'wb' ) { |file|
file.write(response.body)
}
import requests
import json
url = "http://localhost:8080/ZPLPrinter"
jsondata = json.dumps( {"zplCommands": "^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ"} )
headers = {
'content-type': "application/json",
'accept': "image/png"
}
response = requests.request("POST", url, data=jsondata, headers=headers)
if response.status_code == 200:
with open("label.png", 'wb') as f:
f.write(response.content)
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $server_endpoint = "http://localhost:8080/ZPLPrinter";
my $req = HTTP::Request->new(POST => $server_endpoint);
$req->header('content-type' => 'application/json');
$req->header('accept' => 'image/png');
my $post_data = '{ "zplCommands" : "^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ" }';
$req->content($post_data);
my $resp = $ua->request($req);
open FILEHANDLE, ">label.png";
print FILEHANDLE $resp->{_content};
close FILEHANDLE;
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("http://localhost:8080/ZPLPrinter");
String json = "{\"zplCommands\" : \"^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ\"}";
StringEntity entity = new StringEntity(json);
httpPost.setEntity(entity);
httpPost.setHeader("Accept", "image/png");
httpPost.setHeader("Content-type", "application/json");
CloseableHttpResponse response = client.execute(httpPost);
HttpEntity entity = response.getEntity();
if (entity != null) {
try (FileOutputStream outstream = new FileOutputStream(new File("label.png"))) {
entity.writeTo(outstream);
}
}
client.close();
string DATA = "{\"zplCommands\" : \"^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ\"}";
var request = (HttpWebRequest)WebRequest.Create("http://localhost:8080/ZPLPrinter");
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = DATA.Length;
request.Accept = "image/png";
using (var requestWriter = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII)){
requestWriter.Write(DATA);
}
var webResponse = request.GetResponse();
using (var stream = webResponse.GetResponseStream())
using (var fileStream = File.OpenWrite("label.png"))
{
var bytes = new byte[4096];
var read=0;
do
{
if (stream == null) {continue;}
read = stream.Read(bytes, 0, bytes.Length);
fileStream.Write(bytes, 0, read);
} while (read != 0);
}
var data = JSON.stringify({
"zplCommands": "^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://localhost:8080/ZPLPrinter");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "image/png");
xhr.send(data);
var request = require('request');
var headers = {
'Accept': 'image/png',
'Content-Type': 'application/json'
}
var options = {
url: 'http://localhost:8080/ZPLPrinter',
method: 'POST',
headers: headers,
json: {"zplCommands": "^XA^FO30,40^ADN,36,20^FDHello World^FS^FO30,80^BY4^B3N,,200^FD12345678^FS^XZ"}
}
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
})
The desired output rendering format must be specified through the Accept header. The supported formats are the following:
Accept | Description |
---|---|
image/png |
Returns the first rendered label in PNG format. If the specified commands generate more than one label, then you should specify image/png+json or image/png+zip values instead. |
image/jpeg |
Returns the first rendered label in JPEG/JPG format. If the specified commands generate more than one label, then you should specify image/jpeg+json or image/jpeg+zip values instead. |
application/pdf |
Returns all the rendered labels as a single PDF document. The PDF file will contain as many pages as rendered labels. |
image/vnd.zbrush.pcx |
Returns the first rendered label in PCX format. If the specified commands generate more than one label, then you should specify image/vnd.zbrush.pcx+json or image/vnd.zbrush.pcx+zip values instead. |
application/vnd.zpl |
Returns the first rendered label in Zebra GRF ASCII Hex format. If the specified commands generate more than one label, then you should specify application/vnd.zpl+json or application/vnd.zpl+zip values instead. |
application/vnd.epl |
Returns the first rendered label in Zebra EPL Binary Graphic format. If the specified commands generate more than one label, then you should specify application/vnd.zpl+json or application/vnd.zpl+zip values instead. |
application/vnd.fingerprint |
Returns the first rendered label in Honeywell-Intermec FingerPrint Binary format. If the specified commands generate more than one label, then you should specify application/vnd.fingerprint+json or application/vnd.fingerprint+zip values instead. |
application/vnd.escpos |
Returns the first rendered label in EPSON ESC/POS NV Binary format. If the specified commands generate more than one label, then you should specify application/vnd.escpos+json or application/vnd.escpos+zip values instead. |
application/vnd.hp-pcl |
Returns the first rendered label in HP PCL Binary format. If the specified commands generate more than one label, then you should specify application/vnd.hp-pcl+json or application/vnd.hp-pcl+zip values instead. |
image/png+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 PNG Data URI scheme. The returned JSON Object will have this structure: {labels:["data:image/png;base64,<BASE64-STRING>", "data:image/png;base64,<BASE64-STRING>", ... ]} |
image/jpeg+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 JPEG Data URI scheme. The returned JSON Object will have this structure: {labels:["data:image/jpeg;base64,<BASE64-STRING>", "data:image/jpeg;base64,<BASE64-STRING>", ... ]} |
application/pdf+json |
Returns all the rendered labels as a JSON Array containing a single PDF in Base64 Data URI scheme. The PDF file will contain as many pages as rendered labels. The returned JSON Object will have this structure: {labels:["data:application/pdf;base64,<BASE64-STRING>"]} |
image/vnd.zbrush.pcx+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 PCX Data URI scheme. {labels:["data:image/vnd.zbrush.pcx;base64,<BASE64-STRING>", "data:image/vnd.zbrush.pcx;base64,<BASE64-STRING>", ... ]} |
application/vnd.zpl+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 Zebra GRF ASCII Hex Data URI scheme. The returned JSON Object will have this structure: {labels:["data:application/vnd.zpl;base64,<BASE64-STRING>", "data:application/vnd.zpl;base64,<BASE64-STRING>", ... ]} |
application/vnd.epl+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 Zebra EPL Binary Graphic Data URI scheme. The returned JSON Object will have this structure: {labels:["data:application/vnd.epl;base64,<BASE64-STRING>", "data:application/vnd.epl;base64,<BASE64-STRING>", ... ]} |
application/vnd.fingerprint+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 Honeywell-Intermec FingerPrint Binary Data URI scheme. The returned JSON Object will have this structure: {labels:["data:application/vnd.fingerprint;base64,<BASE64-STRING>", "data:application/vnd.fingerprint;base64,<BASE64-STRING>", ... ]} |
application/vnd.escpos+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 EPSON ESC/POS NV Binary Data URI scheme. The returned JSON Object will have this structure: {labels:["data:application/vnd.escpos;base64,<BASE64-STRING>", "data:application/vnd.escpos;base64,<BASE64-STRING>", ... ]} |
application/vnd.hp-pcl+json |
Returns all the rendered labels as a JSON Array containing each label in Base64 HP PCL Binary Data URI scheme. The returned JSON Object will have this structure: {labels:["data:application/vnd.hp-pcl;base64,<BASE64-STRING>", "data:application/vnd.hp-pcl;base64,<BASE64-STRING>", ... ]} |
image/png+zip |
Returns all the rendered labels as a ZIP file containing each label in PNG format. Each file name is named to Label_01.png, Label_02.png, etc. |
image/jpeg+zip |
Returns all the rendered labels as a ZIP file containing each label in JPEG/JPG format. Each file name is named to Label_01.jpg, Label_02.jpg, etc. |
application/pdf+zip |
Returns all the rendered labels as a ZIP file containing a single PDF. The PDF file will contain as many pages as rendered labels. Label_01.pdf |
image/vnd.zbrush.pcx+zip |
Returns all the rendered labels as a ZIP file containing each label in PCX format. Each file name is named to Label_01.pcx, Label_02.pcx, etc. |
application/vnd.zpl+zip |
Returns all the rendered labels as a ZIP file containing each label in Zebra GRF ASCII Hex format. Each file name is named to Label_01.grf, Label_02.grf, etc. |
application/vnd.epl+zip |
Returns all the rendered labels as a ZIP file containing each label in Zebra EPL Binary Graphic format. Each file name is named to Label_01.epl, Label_02.epl, etc. |
application/vnd.fingerprint+zip |
Returns all the rendered labels as a ZIP file containing each label in Honeywell-Intermec FingerPrint Binary format. Each file name is named to Label_01.fp, Label_02.fp, etc. |
application/vnd.escpos+zip |
Returns all the rendered labels as a ZIP file containing each label in EPSON ESC/POS NV Binary format. Each file name is named to Label_01.nv, Label_02.nv, etc. |
application/vnd.hp-pcl+zip |
Returns all the rendered labels as a ZIP file containing each label in HP PCL Binary format. Each file name is named to Label_01.pcl, Label_02.pcl, etc. |
ZPLPrinter Web API for Docker supports most of the ZPL formatting and control commands. The following table lists the supported commands as well as the ones which are under work. Not listed or unsupported commands will be skipped in the parsing stage.
Status | ZPL Command | Comments |
---|---|---|
^A Scalable/Bitmapped Font | ||
^A@ Use Font Name to Call Font | .FNT extension is not supported | |
^B0 Aztec Bar Code Parameters | ECICs and Structured Appended format are not supported | |
^B1 Code 11 Bar Code | ||
^B2 Interleaved 2 of 5 Bar Code | ||
^B3 Code 39 Bar Code | ||
^B4 Code 49 | Starting mode is not supported | |
^B5 Planet Code bar code | ||
^B7 PDF417 Bar Code | ||
^B8 EAN-8 Bar Code | ||
^B9 UPC-E Bar Code | ||
^BA Code 93 Bar Code | ||
^BB Codablock | Codablock-F supported only | |
^BC Code 128 Bar Code (Subsets A, B, and C) | ||
^BD UPS MaxiCode Bar Code | ||
^BE EAN-13 Bar Code | ||
^BF MicroPDF417 Bar Code | ||
^BI Industrial 2 of 5 Bar Codes | ||
^BJ Standard 2 of 5 Bar Code | ||
^BK ANSI Codabar Bar Code | ||
^BL LOGMARS Bar Code | ||
^BM MSI Bar Code | ||
^BO Aztec Bar Code Parameters | ECICs and Structured Appended format are not supported | |
^BP Plessey Bar Code | ||
^BQ QR Code Bar Code | Model 1 and Data Encoding Switches are not supported | |
^BR GS1 Databar | ||
^BS UPC/EAN Extensions | ||
^BT TLC39 | ||
^BU UPC-A Bar Code | ||
^BX Data Matrix Bar Code | Quality Level < 200 is not supported | |
^BY Bar Code Field Default | ||
^BZ POSTAL Bar Code | ||
^CC Change Caret | ||
^CD Change Delimiter | ||
^CF Change Alphanumeric Default Font | ||
^CI Change International Font/Encoding | Character remapping is not supported | |
^CT Change Tilde | ||
^CW Font Identifier | ||
~DB Download Bitmap Font | ||
^DF Download Format | ||
~DG Download Graphics | ||
~DU Download Unbounded TrueType Font | ||
~DY Download Objects | AR-compressed format and bitmap, .pcx, .nrd, .pac, .wml, .htm, .get extensions are not supported | |
~EG Erase Download Graphics | ||
^FA Field Allocate | ||
^FB Field Block | ||
^FC Field Clock | ||
^FD Field Data | ||
^FH Field Hexadecimal Indicator | ||
^FM Multiple Field Origin Locations | ||
^FN Field Number | ||
^FO Field Origin | ||
^FP Field Parameter | ||
^FR Field Reverse Print | ||
^FS Field Separator | ||
^FT Field Typeset | ||
^FV Field Variable | ||
^FW Field Orientation | ||
^FX Comment | ||
^GB Graphic Box | ||
^GC Graphic Circle | ||
^GD Graphic Diagonal Line | ||
^GE Graphic Ellipse | ||
^GF Graphic Field | ||
^GS Graphic Symbol | ||
^ID Object Delete | ||
^IL Image Load | ||
^IM Image Move | ||
^IS Image Save | ||
~JR Power On Reset | ||
^LH Label Home | ||
^LL Label Length | ||
^LR Label Reverse Print | ||
^LS Label Shift | ||
^LT Label Top | ||
^MC Map Clear | ||
^MU Set Units of Measurement | ||
^PA Advanced Text Properties | ||
^PM Printing Mirror Image of Label | ||
^PO Print Orientation | ||
^PQ Print Quantity | ||
^PW Print Width | ||
^RF Read or Write RFID Format | Only Write mode is supported | |
^RQ Quick Write EPC Data and Passwords | ||
^SF Serialization Field | ||
^SL Set Mode and Language (for Real-Time Clock) | ||
^SN Serialization Data | ||
^SO Set Offset (for Real-Time Clock) | ||
^ST Set Date and Time (for Real-Time Clock) | ||
^TB Text Blocks | ||
^TO Transfer Object | ||
~WC Print Configuration Label | ||
^XA Start Format | ||
^XF Recall Format | ||
^XG Recall Graphic | ||
^XZ End Format | ||
^WF Encode AFI or DSFID Byte | ||
^WT Write (Encode) Tag |
ZPLPrinter Web API is licensed for Private On-Premise environments giving you full control on the infrastructure where our product will run on. Please refer to Licensing model and prices...
When you buy a commercial license of ZPLPrinter Web API for Docker, you are provided with license information (LicenseOwner & LicenseKey) to register the product. The license information must be specified to the Docker image as environment variables as folows:
AMDThe Trial Version of ZPLPrinter Web API for Docker is fully functional and has no expiry date. However, while in TRIAL mode, the output rendering has the following limitations:
2024-11-13
2024-09-11
2024-08-01
2024-05-31
2024-04-26
2024-04-24
2024-03-04
2024-03-01
2024-01-02
2023-11-23
2023-11-20
2023-11-13
2023-08-30
2023-08-07
2023-07-03
2023-05-24
2023-05-10
2023-03-28
2023-03-22
2023-03-09
2023-02-22
2023-01-17
2022-12-30
2022-12-20
2022-12-06
2022-10-27
2022-10-10
2022-09-21
2022-08-31
2022-07-22
2022-07-04
2022-06-27
2022-06-24
2022-06-01
2022-05-12
2022-04-20
2022-03-18
2022-03-11
2022-03-07
2022-03-02
2022-02-15
2022-02-03
2022-01-24
2021-12-23
2021-11-13
2021-10-31
2021-10-14
2021-10-01
2021-09-22
2021-09-15
2021-09-06
2021-08-13
2021-08-12
2021-08-11
/metrics
2021-08-09
2021-07-28
2021-07-27
2021-07-20
2021-07-06
2021-06-02
2021-04-14
2021-03-31
2021-03-11
2021-03-10
2021-03-06
/health
2021-02-20
2021-02-15
2021-02-10
2021-02-09
2021-02-05
2021-01-30
2020-12-09
2020-12-04
2020-12-02
2020-11-27
2020-10-23
2020-10-20
2020-10-08
2020-09-16
2020-09-15
2020-09-14
2020-09-05
2020-08-28
2020-08-25
2020-08-24
2020-08-21
2020-08-20
2020-08-19
2020-08-17
2020-06-10
2020-04-13
2020-04-03
2020-04-01
2020-03-10
2020-03-03
2020-02-06
2020-01-21