PDF templates / Receipt

Thermal Receipt

80mm thermal-printer format (226.77pt wide) with Cousine monospace, dashed separators, two-column item/price rows and a printed barcode number. Paper-roll style.

First page of the Thermal Receipt template, rendered with its sample data
receipt-thermal.pdfpage 1 of 2

DSL source

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

js
const dash = "--------------------------------";

const sep = () => r({ align: "center" }, s(".mono", dash));
const centered = (cls, text) => r({ align: "center" }, s(cls, text));
const twoCol = (left, right) =>
  r(
    col("60%", s(".mono", left)),
    col({ width: "40%", align: "right" }, s(".mono", right)),
  );

const template = doc(
  {
    size: { width: 226.77, height: 720 },
    title: "Receipt {{receiptNumber}}",
    padding: [10, 8, 10, 8],
    styles: {
      ".mono": { "font-family": "Cousine", "font-size": 8, "line-height": 1.3 },
      ".mono-bold": { "font-family": "Cousine", "font-size": 8, "font-weight": "bold", "line-height": 1.3 },
      ".mono-lg": { "font-family": "Cousine", "font-size": 11, "font-weight": "bold", "line-height": 1.3 },
      ".mono-sm": { "font-family": "Cousine", "font-size": 7, "line-height": 1.3 },
      ".mono-barcode": { "font-family": "Cousine", "font-size": 10, "line-height": 1.4, "letter-spacing": 1 },
    },
  },
  centered(".mono-lg", "{{store.name}}"),
  centered(".mono", "{{store.branch}}"),
  centered(".mono", "{{store.address}}"),
  centered(".mono", "Tel: {{store.phone}}"),
  centered(".mono", "{{store.website}}"),
  centered(".mono-sm", "Tax ID: {{store.taxId}}"),
  sep(),
  twoCol("Receipt:", "{{receiptNumber}}"),
  twoCol("Txn ID:", "{{transactionId}}"),
  twoCol("Date:", "{{date}}"),
  twoCol("Time:", "{{time}}"),
  twoCol("Cashier:", "{{cashier}}"),
  twoCol("Register:", "{{register}}"),
  sep(),
  r(s(".mono-bold", "MEMBER")),
  twoCol("Name:", "{{customer.name}}"),
  twoCol("Loyalty ID:", "{{customer.loyaltyId}}"),
  twoCol("Member since:", "{{customer.memberSince}}"),
  twoCol("Points earned:", "{{customer.pointsEarned}}"),
  twoCol("Points balance:", "{{customer.pointsBalance}}"),
  sep(),
  r(s(".mono-bold", "ITEMS")),
  sep(),
  each(
    "item in items",
    r(s(".mono", "{{item.description}}")),
    r(s(".mono-sm", "SKU {{item.sku}}")),
    twoCol(
      "  {{item.qty}} {{item.unit}} @ ${{item.unitPrice}}",
      "${{item.total}}",
    ),
  ),
  sep(),
  twoCol("Item count:", "{{itemCount}}"),
  twoCol("Subtotal:", "${{subtotal}}"),
  twoCol("{{discountLabel}}:", "-${{discountAmount}}"),
  twoCol("Taxable amount:", "${{taxableAmount}}"),
  twoCol("{{taxLabel}}:", "${{taxAmount}}"),
  sep(),
  r(
    col("60%", s(".mono-bold", "TOTAL")),
    col({ width: "40%", align: "right" }, s(".mono-bold", "${{total}}")),
  ),
  sep(),
  r(s(".mono-bold", "PAYMENT")),
  twoCol("Method:", "{{tender.method}}"),
  twoCol("Card:", "****{{tender.cardLast4}}"),
  twoCol("Auth code:", "{{tender.authCode}}"),
  twoCol("Tendered:", "${{tender.amountTendered}}"),
  twoCol("Change:", "${{tender.change}}"),
  sep(),
  r(s(".mono-bold", "RETURN POLICY")),
  r(s(".mono-sm", "{{returnPolicy}}")),
  sep(),
  gap(6),
  r({ align: "center" }, barcode("{{barcode}}", { format: "code128", width: 200, height: 40, "show-text": true, alt: "Receipt code {{barcode}}" })),
  gap(6),
  sep(),
  centered(".mono", "{{footerMessage}}"),
  gap(4),
  centered(".mono-sm", "-- end of receipt --"),
);

const sampleData = {
  receiptNumber: "R-2026-004188",
  transactionId: "TXN-880423117",
  date: "18 April 2026",
  time: "14:32:07",
  store: {
    name: "Greenfield Market",
    branch: "Store #042 — Capitol Hill",
    address: "1820 Broadway Ave E\nSeattle, WA 98122",
    phone: "(206) 555-0182",
    website: "greenfieldmarket.example.com",
    taxId: "WA-UBI 602-341-887",
  },
  cashier: "Avery M.",
  register: "POS-03",
  customer: {
    name: "Jordan Rivera",
    loyaltyId: "GM-7788-2241",
    memberSince: "14 August 2022",
    pointsEarned: 58,
    pointsBalance: "2,416.00",
  },
  items: [
    { sku: "4011", description: "Bananas, organic (per lb)", qty: 2.14, unit: "lb", unitPrice: "0.89", total: "1.90" },
    { sku: "094118", description: "Sourdough boule — bakery", qty: 1, unit: "ea", unitPrice: "6.50", total: "6.50" },
    { sku: "041800", description: "Free-range eggs (dozen)", qty: 2, unit: "ea", unitPrice: "7.25", total: "14.50" },
    { sku: "871223", description: "Cold-brew coffee, 32 oz", qty: 1, unit: "ea", unitPrice: "9.99", total: "9.99" },
    { sku: "204501", description: "Whole milk, 1 gal", qty: 1, unit: "ea", unitPrice: "5.79", total: "5.79" },
    { sku: "667210", description: "Greek yogurt, vanilla (6-pack)", qty: 1, unit: "ea", unitPrice: "8.49", total: "8.49" },
    { sku: "330118", description: "Avocados, hass (bag of 4)", qty: 1, unit: "ea", unitPrice: "6.99", total: "6.99" },
    { sku: "552019", description: "Dark chocolate, 70% (bar)", qty: 3, unit: "ea", unitPrice: "3.75", total: "11.25" },
  ],
  itemCount: 12,
  subtotal: "65.41",
  discountLabel: "Member savings",
  discountAmount: "3.27",
  taxableAmount: "62.14",
  taxRate: 0.101,
  taxLabel: "WA Sales Tax (10.1%)",
  taxAmount: "6.28",
  total: "68.42",
  tender: {
    method: "Visa Credit",
    cardLast4: "4821",
    authCode: "118-73A",
    amountTendered: "68.42",
    change: 0,
  },
  barcode: "0046007700488412007",
  returnPolicy: "Returns accepted within 30 days with receipt. Perishables final sale.",
  footerMessage: "Thank you for shopping at Greenfield Market — see you again soon!",
};

Sample data

json
{
  "receiptNumber": "R-2026-004188",
  "transactionId": "TXN-880423117",
  "date": "18 April 2026",
  "time": "14:32:07",
  "store": {
    "name": "Greenfield Market",
    "branch": "Store #042 — Capitol Hill",
    "address": "1820 Broadway Ave E\nSeattle, WA 98122",
    "phone": "(206) 555-0182",
    "website": "greenfieldmarket.example.com",
    "taxId": "WA-UBI 602-341-887"
  },
  "cashier": "Avery M.",
  "register": "POS-03",
  "customer": {
    "name": "Jordan Rivera",
    "loyaltyId": "GM-7788-2241",
    "memberSince": "14 August 2022",
    "pointsEarned": 58,
    "pointsBalance": "2,416.00"
  },
  "items": [
    {
      "sku": "4011",
      "description": "Bananas, organic (per lb)",
      "qty": 2.14,
      "unit": "lb",
      "unitPrice": "0.89",
      "total": "1.90"
    },
    {
      "sku": "094118",
      "description": "Sourdough boule — bakery",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "6.50",
      "total": "6.50"
    },
    {
      "sku": "041800",
      "description": "Free-range eggs (dozen)",
      "qty": 2,
      "unit": "ea",
      "unitPrice": "7.25",
      "total": "14.50"
    },
    {
      "sku": "871223",
      "description": "Cold-brew coffee, 32 oz",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "9.99",
      "total": "9.99"
    },
    {
      "sku": "204501",
      "description": "Whole milk, 1 gal",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "5.79",
      "total": "5.79"
    },
    {
      "sku": "667210",
      "description": "Greek yogurt, vanilla (6-pack)",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "8.49",
      "total": "8.49"
    },
    {
      "sku": "330118",
      "description": "Avocados, hass (bag of 4)",
      "qty": 1,
      "unit": "ea",
      "unitPrice": "6.99",
      "total": "6.99"
    },
    {
      "sku": "552019",
      "description": "Dark chocolate, 70% (bar)",
      "qty": 3,
      "unit": "ea",
      "unitPrice": "3.75",
      "total": "11.25"
    }
  ],
  "itemCount": 12,
  "subtotal": "65.41",
  "discountLabel": "Member savings",
  "discountAmount": "3.27",
  "taxableAmount": "62.14",
  "taxRate": 0.101,
  "taxLabel": "WA Sales Tax (10.1%)",
  "taxAmount": "6.28",
  "total": "68.42",
  "tender": {
    "method": "Visa Credit",
    "cardLast4": "4821",
    "authCode": "118-73A",
    "amountTendered": "68.42",
    "change": 0
  },
  "barcode": "0046007700488412007",
  "returnPolicy": "Returns accepted within 30 days with receipt. Perishables final sale.",
  "footerMessage": "Thank you for shopping at Greenfield Market — see you again soon!"
}

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": "receipt-thermal"}' \
  -o output.pdf