Skip to content

How to convert NiceLabel files to ZPL

To convert a NiceLabel file, send its bytes as the body of a POST request to /api/v2/convert/nlbl/to/zpl. The nlbl source reads .nlbl files from NiceLabel and ZebraDesigner 3. For a legacy NiceLabel .lbl file, use the lbl source.

Terminal window
curl -X POST "https://api.labelzoom.com/api/v2/convert/nlbl/to/zpl?dpi=203" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/octet-stream" \
--data-binary @label.nlbl \
--output label.zpl

Replace API_KEY with your API key. To get a PDF or an image instead, change the target, such as /nlbl/to/pdf.

Source File Content-Type
nlbl .nlbl application/octet-stream or application/zip
lbl .lbl from NiceLabel Pro 4 and 5 application/octet-stream

If your client can send only text, send the file as base64 with Content-Type: text/plain. Send the file with --data-binary; -d corrupts binary data. A .lbl file saved by another NiceLabel version returns 400.

To fill the label’s variables, pass data with one object per label. Each key is a variable or data source name from the file:

POST /api/v2/convert/nlbl/to/zpl?params={"data":[{"ProductName":"Widget","SKU":"12345"}]}

Without data, each bound object prints the sample value saved in the file, and that value is fixed in the ZPL. Date and time variables print the sample saved when the file was designed, not the current date. For a GS1-128 barcode, pass the complete value, including any check digits. For details, see Variable data.

To keep the variables for later, convert to xml or json, or to ZPL with a dialect. Bound objects then stay as merge fields.

For each dimension, the API uses label.width or label.height from the request, then the label size saved in the file, then the extent of the content. Set dpi to the density of the target printer. See Label size.

Text, barcodes, images, lines, rectangles, ellipses, and inverse areas convert. Some objects change:

Object Output
WMF image Left out
Dashed line Solid line
Filled shape Outline
Non-circular ellipse Rounded rectangle
Colors Black or white, whichever is nearer
Barcode readable text The renderer’s font and size

A centered object is placed for its sample value, so a longer value from data can shift it.

Symptom Fix
400 for a .lbl file The file was saved by a NiceLabel version other than Pro 4 or 5. Open it in NiceLabel and export it as .nlbl.
A variable prints null A key in data is missing for that variable. Add the key, using the variable name from the file.
The label is the wrong size Set label.width and label.height, in inches, and dpi.