PDF templates / Shipping Label

Compact Shipping Label

4x6 inch (288pt × 432pt) thermal-printer-compatible label with dense sender/recipient addresses, large tracking barcode, minimal parcel info. Drop-in for thermal label printers.

First page of the Compact Shipping Label template, rendered with its sample data
shipping-label-compact.pdfpage 1 of 2

DSL source

The whole template. Learn the language in the template DSL guide.

js
const template = doc(
  { size: { width: 288, height: 432 }, title: "Shipping Label {{trackingNumber}}", padding: 0 },
  // Top bar: Carrier + Service
  col({ "background-color": "#000000", padding: [6, 8, 6, 8] },
    r(
      col("60%", s({ "font-size": 14, "font-weight": "bold", color: "#ffffff" }, "{{carrier}}")),
      col({ width: "40%", align: "right" }, s({ "font-size": 10, color: "#ffffff", "font-weight": "bold" }, "{{serviceLevel}}")),
    ),
  ),
  // Service + ship date strip
  col({ padding: [4, 8, 4, 8], "border": "0 0 1 0", "border-color": "#000000" },
    r(
      col("60%", s({ "font-size": 8, "font-weight": "bold" }, "{{service}}")),
      col({ width: "40%", align: "right" }, s({ "font-size": 7 }, "SHIP: {{shipDate}}")),
    ),
  ),
  // SHIP FROM
  col({ padding: [4, 8, 4, 8] },
    s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "SHIP FROM:"),
    s({ "font-size": 8, "font-weight": "bold" }, "{{sender.name}}"),
    s({ "font-size": 7 }, "{{sender.contact}}"),
    s({ "font-size": 7 }, "{{sender.address1}}"),
    s({ "font-size": 7 }, "{{sender.address2}}"),
    s({ "font-size": 7 }, "{{sender.city}}, {{sender.state}} {{sender.postalCode}}"),
    s({ "font-size": 7 }, "{{sender.country}} • {{sender.phone}}"),
  ),
  hr(0, "#000000"),
  // SHIP TO (prominent)
  col({ padding: [6, 8, 6, 8] },
    s({ "font-size": 7, color: "#000000", "font-weight": "bold" }, "SHIP TO:"),
    gap(2),
    s({ "font-size": 11, "font-weight": "bold" }, "{{recipient.name}}"),
    s({ "font-size": 9, "font-weight": "bold" }, "{{recipient.company}}"),
    s({ "font-size": 10, "font-weight": "bold" }, "{{recipient.address1}}"),
    s({ "font-size": 10, "font-weight": "bold" }, "{{recipient.address2}}"),
    s({ "font-size": 12, "font-weight": "bold" }, "{{recipient.city}}, {{recipient.state}} {{recipient.postalCode}}"),
    s({ "font-size": 9, "font-weight": "bold" }, "{{recipient.country}}"),
    s({ "font-size": 8 }, "Tel: {{recipient.phone}}"),
  ),
  hr(0, "#000000"),
  // Routing / zone / sort
  col({ padding: [4, 8, 4, 8] },
    r(
      col("50%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "ROUTING"),
        s({ "font-family": "Cousine", "font-size": 10, "font-weight": "bold" }, "{{routingCode}}"),
      ),
      col({ width: "25%", align: "center" },
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "ZONE"),
        s({ "font-size": 14, "font-weight": "bold" }, "{{zone}}"),
      ),
      col({ width: "25%", align: "right" },
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "SORT"),
        s({ "font-family": "Cousine", "font-size": 10, "font-weight": "bold" }, "{{sortCode}}"),
      ),
    ),
  ),
  hr(0, "#000000"),
  // Parcel info grid
  col({ padding: [4, 8, 4, 8] },
    r(
      col("33%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "WEIGHT"),
        s({ "font-size": 8, "font-weight": "bold" }, "{{parcel.weight}}"),
      ),
      col("34%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "DIMENSIONS"),
        s({ "font-size": 8, "font-weight": "bold" }, "{{parcel.dimensions}}"),
      ),
      col("33%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "PKG"),
        s({ "font-size": 8, "font-weight": "bold" }, "{{parcel.packageCount}} • {{parcel.packageType}}"),
      ),
    ),
    gap(3),
    r(
      col("50%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "DECLARED VALUE"),
        s({ "font-size": 8, "font-weight": "bold" }, "{{parcel.declaredValue}}"),
      ),
      col("50%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "EXPECTED DELIVERY"),
        s({ "font-size": 8, "font-weight": "bold" }, "{{expectedDelivery}}"),
      ),
    ),
  ),
  hr(0, "#000000"),
  // Reference + order
  col({ padding: [4, 8, 4, 8] },
    r(
      col("55%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "REFERENCE"),
        s({ "font-family": "Cousine", "font-size": 8 }, "{{reference}}"),
      ),
      col("45%",
        s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "ORDER #"),
        s({ "font-family": "Cousine", "font-size": 8 }, "{{orderNumber}}"),
      ),
    ),
  ),
  // Instructions
  col({ padding: [3, 8, 3, 8], "background-color": "#000000" },
    s({ "font-size": 7, color: "#ffffff", "font-weight": "bold" }, "{{instructions}}"),
  ),
  // Barcode area
  col({ padding: [8, 8, 4, 8], align: "center" },
    s({ "font-size": 6, color: "#555555", "font-weight": "bold" }, "TRACKING #"),
    gap(2),
    s({ "font-family": "Cousine", "font-size": 10, "font-weight": "bold" }, "{{trackingNumber}}"),
    gap(4),
    col({ "background-color": "#ffffff", padding: [6, 4, 6, 4], border: 1, "border-color": "#000000", width: "95%", align: "center" },
      barcode("{{trackingNumber}}", { format: "code128", width: 240, height: 56, "show-text": true, alt: "Tracking {{trackingNumber}}" }),
    ),
  ),
);

const sampleData = {
  trackingNumber: "1Z999AA10123456784",
  carrier: "UPS",
  service: "UPS Ground",
  serviceLevel: "Ground",
  shipDate: "20 April 2026",
  expectedDelivery: "24 April 2026",
  reference: "PO-2026-004871",
  orderNumber: "WEB-5581209",
  sender: {
    name: "Northline Distribution Center",
    contact: "Shipping Dept",
    address1: "2500 Logistics Way, Suite 100",
    address2: "Dock 14",
    city: "Los Angeles",
    state: "CA",
    postalCode: "90015",
    country: "USA",
    phone: "(213) 555-0177",
  },
  recipient: {
    name: "Margaret Thompson",
    company: "Thompson Design Studio",
    address1: "456 Park Avenue",
    address2: "Apartment 12B",
    city: "New York",
    state: "NY",
    postalCode: "10022",
    country: "USA",
    phone: "(212) 555-0199",
  },
  parcel: {
    weight: "2.5 lbs",
    dimensions: "12 x 8 x 6 in",
    packageCount: "1 of 1",
    packageType: "Box",
    declaredValue: "$185.00",
  },
  zone: "7",
  routingCode: "NYC-212-10022",
  sortCode: "A14-2",
  instructions: "Signature required. Do not leave unattended.",
};

Sample data

json
{
  "trackingNumber": "1Z999AA10123456784",
  "carrier": "UPS",
  "service": "UPS Ground",
  "serviceLevel": "Ground",
  "shipDate": "20 April 2026",
  "expectedDelivery": "24 April 2026",
  "reference": "PO-2026-004871",
  "orderNumber": "WEB-5581209",
  "sender": {
    "name": "Northline Distribution Center",
    "contact": "Shipping Dept",
    "address1": "2500 Logistics Way, Suite 100",
    "address2": "Dock 14",
    "city": "Los Angeles",
    "state": "CA",
    "postalCode": "90015",
    "country": "USA",
    "phone": "(213) 555-0177"
  },
  "recipient": {
    "name": "Margaret Thompson",
    "company": "Thompson Design Studio",
    "address1": "456 Park Avenue",
    "address2": "Apartment 12B",
    "city": "New York",
    "state": "NY",
    "postalCode": "10022",
    "country": "USA",
    "phone": "(212) 555-0199"
  },
  "parcel": {
    "weight": "2.5 lbs",
    "dimensions": "12 x 8 x 6 in",
    "packageCount": "1 of 1",
    "packageType": "Box",
    "declaredValue": "$185.00"
  },
  "zone": "7",
  "routingCode": "NYC-212-10022",
  "sortCode": "A14-2",
  "instructions": "Signature required. Do not leave unattended."
}

Render it with your data

Any API key can render this template by its ID. This call uses the sample data; add a data object to use your own. See the API reference.

bash
curl -X POST https://makespdf.com/api/v1/render \
  -H "Authorization: Bearer $MAKESPDF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"templateId": "shipping-label-compact"}' \
  -o output.pdf