Building a Shipping Label Template
Create a compact shipping label template with sender/recipient addresses, barcodes, and tracking information.
Overview
Shipping labels are compact, information-dense documents designed for printing at 4×6 inches (thermal label printers) or on A4/Letter paper with crop marks.
Page Setup
- Size: 288 × 432px (4 × 6 inches at 72 DPI)
- Orientation: Portrait
- Margins: 10px all sides
- Background: White with a 2px black border
For standard label printers (Zebra, DYMO), use 4×6 inch dimensions. For desktop printing, use A4 size with the label area centered.
Sender (From) Section
Top third of the label:
- Label text "FROM:" — 8px, bold, uppercase
senderName— 10px, boldsenderAddress— 9px, regularsenderCity,senderState,senderZip
Recipient (To) Section
Middle section, larger text for readability:
- Label text "TO:" — 10px, bold, uppercase
recipientName— 14px, boldrecipientAddress— 12px, regularrecipientCity,recipientState,recipientZiprecipientCountry— 12px, bold (for international)
Tracking & Barcode Section
Bottom section:
trackingNumber— 10px, monospace fontbarcodeImage— Dynamic image field for barcode (generated externally)shippingMethod— e.g., "Priority", "Express", "Standard"weight— Package weight
Barcode Generation
Generate barcodes in your backend using a library likebwip-js (Node) or python-barcode, then pass the image URL via the barcodeImage field.Layout Tips
- Use line elements to separate sender and recipient sections
- Keep fonts large enough to be readable at arm's length
- Use bold for important fields (name, city, tracking)
- Leave adequate white space around the barcode for scanners
Sample API Data
Generate Request Data
{
"templateId": "tmpl_shipping_label",
"data": {
"senderName": "Acme Store",
"senderAddress": "456 Commerce Ave",
"senderCity": "San Francisco",
"senderState": "CA",
"senderZip": "94102",
"recipientName": "Alice Johnson",
"recipientAddress": "123 Main Street, Apt 4B",
"recipientCity": "New York",
"recipientState": "NY",
"recipientZip": "10001",
"recipientCountry": "USA",
"trackingNumber": "1Z999AA10123456784",
"shippingMethod": "Priority",
"weight": "2.4 lbs",
"barcodeImage": "https://example.com/barcode/1Z999AA10123456784.png"
}
}Next Steps
- Packing Slip Template — Include with shipments
- Dynamic Images — Barcode and image fields
- Batch Generation — Print labels in bulk