Industrial barcode label printing on a production line
A scan on the line can submit a ZPL or TSPL label to the printer at that station. The API does not talk to the PLC.
For Manufacturing lines that label a unit when it is scanned
Overview
The line event is a serial number or a work order step. Your MES or the small service beside it renders ZPL or TSPL and posts it to the station printer. The PLC and the printer are not required to share a protocol.
Keep dpi and label size in the station record. A 600 dpi industrial head will shrink a 203 dpi layout. Test one label at shift start.
Use the serial number as the idempotency key so a double scan does not apply two labels to two different units... unless your process wants a reprint, in which case the key includes a reprint counter.
Integration steps
- 01
Decide the printer before the click
Map the station, store, or line to a printer_code from GET /v1/printers. Do not ask the operator to pick a dialog.
- 02
Create the document in your system
PDF for driver printers, raw ZPL or ESC/POS when the device speaks that language.
- 03
POST when the business event happens
Pack, pay, check-in, or scan. Not on every autosave. Use the business id as Idempotency-Key.
- 04
Show the job result where the work is
queued is not done. Surface AGENT_OFFLINE and PRINT_ERROR to the person at the bench.
Node.js
// Line label
const res = await fetch('https://api.printbase.cloud/v1/print-jobs', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PRINTBASE_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': idempotencyKey,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'raw',
content: Buffer.from(payload).toString('base64'),
copies: 1,
}),
});
if (!res.ok) throw new Error(`PrintBase ${res.status}: ${await res.text()}`);
const job = await res.json();
// { id: "job_abc", status: "queued" }
Details for this setup
Double scan
Decide the rule explicitly. The default key suppresses a second job. The agent prints only what you send; it does not fetch the document from the platform for you.
Raw language
Zebra lines want ZPL. Many TSC lines want TSPL. Do not share one template. The agent prints only what you send; it does not fetch the document from the platform for you.
Questions
Does PrintBase talk Modbus or OPC?
No. Your MES calls the HTTP API. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
QR codes? in this setup
Put ^BQ or the TSPL QR command in the payload. The API does not draw it.
Label applied by a machine?
You still send bytes to the printer queue. Applicator timing is outside this API.
Audit? in this setup
Store the job id next to the serial in the MES. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
Free plan: 100 jobs a month on one computer, no card.