Skip to content

How to convert ZPL to PDF with the API

To convert ZPL to PDF, send the ZPL as the body of a POST request to /api/v2/convert/zpl/to/pdf. The response body is the PDF.

Terminal window
curl -X POST "https://api.labelzoom.com/api/v2/convert/zpl/to/pdf?label.width=4&label.height=6&dpi=203" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: text/plain" \
--data-binary @label.zpl \
--output label.pdf

Replace API_KEY with your API key, or omit the header to convert on the free tier. An invalid key doesn’t return an error: the label converts with a watermark. See Authentication.

Send a file with --data-binary, because -d @label.zpl strips the file’s line breaks. For inline ZPL, -d works.

The SDKs make the same request in one call. For all eight languages, see the API quickstart.

Set label.width and label.height, in inches, and dpi to match the label the ZPL was written for. At the wrong density, the label comes out the wrong size: a 300 dpi label converted at 203 dpi is too large and gets clipped.

For density values, see Printer density. For every parameter, see Conversion parameters.

  • If the status is 200, the response body is the PDF.
  • For any other status, see Errors for the cause and whether to retry.
  • Log the X-LZ-Request-ID response header. Support uses it to find your conversion.
  • Reuse HTTP connections with keep-alive or one shared client instance.
  • If you get 429, wait the number of seconds in the Retry-After header, then retry. See Rate limits.
  • A ZPL file with several ^XA…^XZ blocks holds several labels. For how they convert on the free tier, see Free tier.