Skip to content

Quickstart

This page shows how to convert a ZPL label to PDF with an official SDK.

Terminal window
npm install @labelzoom/sdk

Requires Node.js 20 or later. See the JavaScript quickstart.

import { writeFile } from 'node:fs/promises';
import { LabelZoomClient } from '@labelzoom/sdk';
const client = new LabelZoomClient(); // reads LABELZOOM_API_KEY
const result = await client.convert()
.fromZpl('^XA^FO50,50^ADN,36,20^FDLabelZoom^FS^XZ')
.toPdf()
.withLabelSize(4, 6) // inches
.withDpi(203)
.execute();
await writeFile('label.pdf', result.bytes);

Open label.pdf. Without an API key or a paid plan, the label has a watermark.

Every conversion is one HTTP request:

POST https://api.labelzoom.com/api/v2/convert/{source}/to/{target}

Send the label as the request body. The response body is the converted file. To convert label.zpl to PDF with curl, run the following command:

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

Replace API_KEY with your key, or omit the Authorization header to convert on the free tier. Accept: */* works for every target; the target’s media type or a wildcard such as image/* also works. Use --data-binary so that curl sends the file unchanged.

Each language quickstart shows the same request with that language’s HTTP client, for example Python.

Set options as query parameters:

Parameter Description
label.width Label width in inches. Omit both label.width and label.height to use the label’s own size.
label.height Label height in inches.
dpi Print density in dots per inch. The default is 203.

For every parameter, see Conversion parameters. For the {source} and {target} values and the Content-Type that each source needs, see Supported formats. To try requests in your browser, use the Swagger UI.