Building Order-Specific Labeling on Top of a Label Printing API
Maya is a freelance developer with a three-week contract and one very specific problem. Her client runs a small e-commerce shop and ships between 80 and 400 orders a day. Every parcel that leaves the warehouse needs a label with the order number, the SKU, a scannable barcode and the customer address. Today someone exports a CSV, opens a label design tool, retypes fields, and hits print. At 20 orders that is a chore. At 300 it is a full-time job, and the mistakes go straight to customers.
So Maya is building a fulfillment dashboard, and the last missing piece is output. Her instinct is to write the renderer herself: generate a barcode, lay out a PDF, find a driver that accepts the printer’s native language. Two days later she has a PDF that looks fine and a barcode that scans maybe seven times out of ten. That is the moment the real question appears. Not “can I render a label in code?” but “which label printing API for order specific labeling should I build on, and how do I structure the integration so the client can change the design without filing a ticket?”
This is the playbook she should have started with.
Why Order-Specific Labeling Is a Different Beast for Developers
A product label is a template. An order label is a record. That distinction changes everything about how you build.
- Every label is unique. Data varies per order, per line item, per customer, per carrier. There is no “print the same label 500 times” path to optimize for.
- The data source is not a spreadsheet. It lives in your order management system, your warehouse software, or an API you already call from the dashboard.
- Design changes are constant. Marketing wants a logo moved, the client wants a different barcode size, a new carrier needs its own layout. If the layout lives in your application code, every one of those changes is a deploy.
- Errors are expensive. A barcode that does not scan, or an address that is one line off, is a returned parcel and a support ticket.
Traditional label design software assumes a human sits in front of it. That works until the human becomes the bottleneck or the error source. What developers need instead is a template designed once, plus a programmatic way to inject order data into it at print time — barcodes generated on the fly, conditional formatting, different output targets. For the end user who just wants professional-looking labels, that same mechanism is what guarantees every label comes out consistent and on-brand, without anyone needing design skills.
If your order data already lives in spreadsheets rather than a database, the mechanics of lookup tables and data files are covered in How to Create Labels from Excel Data Files and Lookup Tables. This article assumes an API-first flow.
A Practical Playbook: From Order Data to Printed Label
Here is the sequence. It works with any serious label platform; the concrete steps below describe how it looks with Next Generation Label Printing System (RSJ LPSNG), which is the managed option that hides most of the plumbing.
Step 1: Design the template once, in the label studio
Open the web UI and build the label the way a designer would: logo, typography, fixed legal text, carrier markings. For every variable piece, create a named placeholder instead of typing a literal value — order_number, sku, barcode, ship_to, weight.
The names matter. They are the contract between the artwork and your code. Once they exist, the design can change ten times without a single line of your application changing.
Step 2: Submit a print job with order data as JSON
The web service API accepts print jobs. You send the order data, reference the template, and state what you want back: PDF, PNG, or a direct print.
{
"template": "order-label-4x6",
"output": { "format": "pdf" },
"data": {
"order_number": "SO-2026-104412",
"sku": "TSHIRT-BLK-L",
"barcode": "SO-2026-104412-TSHIRT-BLK-L",
"ship_to": "M. Weber\nBahnhofstr. 12\n78462 Konstanz\nDE"
}
}
From your service, that is one call per order — or one batch call per picking wave:
// Illustrative request shape. The exact endpoint and payload fields for your
// instance are in the Web Service Interface reference.
const res = await fetch(`${process.env.LPSNG_BASE_URL}/job`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${await token()}`,
},
body: JSON.stringify(job),
});
if (!res.ok) throw new Error(`label job failed: ${res.status}`);
const { pdfUrl } = await res.json();
The template is referenced by name, so Maya’s dashboard never contains layout code. When the client asks for a bigger barcode, someone edits the template and nothing redeploys.
Step 3: Push the messy formatting into field scripts
Real order data is ugly. Dates arrive as ISO strings, names arrive in mixed case, addresses need country-specific ordering. Rather than normalizing everything in your application, attach a Python script block to the field that needs it — the Field Script API lets a script read and modify a field value before printing.
# Illustrative. A field script has access to the field value and the job data;
# the exact signature is documented in the Python API reference.
ship_to = "\n".join(filter(None, [
data["customer"]["name"],
data["customer"]["street"],
f'{data["customer"]["zip"]} {data["customer"]["city"]}',
data["customer"]["country"],
]))
return ship_to.strip()
This is where conditional logic belongs: a PRIORITY badge that only renders for express orders, a second barcode that appears only for international shipments, a date reformatted for the carrier’s spec. It keeps the transformation next to the field it affects instead of scattered across your codebase.
Step 4: Authenticate with the simplified OAuth2 flow
RSJ LPSNG uses OAuth2 — but a simplified registration protocol rather than the full dance. External systems are connected with a single URL, which is exactly what you want when the integrating party is a warehouse terminal or a base station rather than a browser.
Do the registration once, store the credential in your secret manager, and let your service refresh as needed. There is no reason to hand-roll an authorization-code flow when the platform ships a shorter path.
Step 5: Choose the output per use case
The API renders single labels as PDF or PNG, and can print directly. In practice you will mix them:
- PDF for packing slips and anything archived or emailed.
- PNG for previews inside your dashboard, so the operator sees the label before committing to a print run.
- Direct print for the normal warehouse path, where the label goes to the thermal printer without a file in between.
Step 6: Cover the shelf, not just the parcel
If your client also runs a physical store, the same order data can drive electronic shelf labels. The vendor-neutral JSON interface (ESLSEND) updates ESL displays, and there is a separate web service for binding tags to items on devices without a browser. The binding workflow gets its own treatment in How to Connect ESL Tags to Items via API.
{
"//": "Illustrative shape. The vendor-neutral ESLSEND JSON is specified in the ESL Interface reference.",
"tags": [
{ "tag": "ESL-0142", "sku": "TSHIRT-BLK-L", "price": "29.90", "currency": "EUR" }
]
}
Step 7: Keep a local escape hatch
Some sites have no reliable network at the packing bench, or the client refuses to run a server. The LPSNG Player is a standalone command-line print engine: package plus data in, PDF/PNG/JSON/print/ESL out.
# Package + data in, PDF/PNG/JSON/print/ESL out.
# See the LPSNG Player reference for the current flag names.
lpsng-player order-label.package order-104412.json --output pdf
That is the same template and the same data contract, running on a laptop or a single-board computer.
What to Avoid When Building Order-Specific Labeling
- Don’t hard-code layouts in your application. The moment the label geometry lives in your source, a design tweak becomes a release. Keep placeholders plus a template, and let the label studio own the pixels.
- Don’t skip barcode verification. Check that the platform supports the 1D and 2D formats you actually need, and test scannability with the real scanner at the real distance. The method is in How to Verify Barcodes Before Printing Labels.
- Don’t build your own OAuth2 flow if the platform offers a simplified registration protocol. It costs you days and adds a security surface you now own.
- Don’t assume all printers behave the same. Confirm whether direct printing is supported for your hardware model before you promise a go-live date. Where it is not, there are documented workarounds — cloud printing among them — but they are workarounds, not the primary path.
- Don’t forget failure handling. What happens when the API is unreachable or an order record is missing a required field? Retry with backoff, queue the job, and show the operator an explicit error rather than silently printing a blank label.
How RSJ LPSNG Fits as a Managed Solution
RSJ LPSNG is a label design and printing platform with a web service API, Python field scripting, and ESL support. For Maya’s project, that means she owns the dashboard and the data mapping, and the platform owns rendering, barcode generation, PDF output, and printer communication.
The pieces that matter for order-specific labeling:
- Label studio for template design, so non-developers can adjust layouts.
- Web service API for print jobs and single-label rendering as PDF or PNG, plus direct printing.
- Field Script API for per-field Python transformations and conditional logic.
- OAuth2 with simplified registration, so connecting an external system is a one-time step.
- Integration options including a Google Sheets add-on, an Excel interface, and a reusable sidebar you can embed into another web application.
Deployment is flexible too. There is a hosted cloud edition for multi-user access, an embedded edition that runs the whole system on a single-board computer such as a Raspberry Pi, and enterprise features for multi-user, multi-region, multi-device environments. That range matters for freelancers: the same integration can start on the cloud edition and move to an embedded box at the client’s site without rewriting the client code.
FAQ
Q: Can I use the API to print labels with data from my order management system? A: Yes. The web service API accepts print jobs with data payloads, so you can send order details (order number, SKU, address) and render labels dynamically. You design the template once and then submit data per order.
Q: How do I handle barcodes that need to be unique per order? A: Use the API to generate barcodes on the fly by including the barcode value in the data payload. The label template can have a barcode field that picks up the value. Supported 1D and 2D formats are documented.
Q: What authentication method does the API use, and how complex is it to set up? A: RSJ LPSNG uses OAuth2 with a simplified registration protocol that connects external systems with a single URL. This reduces the typical OAuth2 complexity, making it easier for developers to integrate.
Q: Can I test label rendering without a physical printer? A: Yes. The API can render labels as PDF or PNG, so you can preview and verify the output before sending it to a printer. The LPSNG Player also supports output to PDF/PNG for testing.
Build the Dashboard, Not the Renderer
The lesson in Maya’s story is not that rendering labels is impossible. It is that rendering labels is a solved problem, and every hour spent on barcode libraries and printer drivers is an hour not spent on the fulfillment logic her client is actually paying for. Design the template once, keep the placeholder names stable, inject order data through the API, and let the platform handle output — PDF for archives, PNG for previews, direct print for the warehouse floor.
If you are staring at the same integration decision, start with the Next Generation Label Printing System web service interface, build one template with real placeholder names, and push a single test order through end to end. That one order tells you more about fit than any feature comparison.
Related posts
- How to Create Labels from Excel Data Files and Lookup Tables
- Zebra Designer Alternative for Developers: What to Compare
- How to Connect ESL Tags to Items via API
