rustedf.cloud
Menu

Free invoice template: HTML and PDF you can copy

Published 2 min read

Free invoice template as a PDF: company details, billed-to block, line items, tax and total on one page

Free template

Use this template for free

Create a free account, click New template in the portal and pick it from the gallery. Then send your own data from the API.

Download the HTMLDownload the sample data

This is a complete invoice you can use as it is or change. It is plain HTML and CSS with placeholders, so it works in any system that can send a request: you fill the placeholders with your data and get a PDF back. Below you can download the sample PDF, copy the code and see the data it expects.

What is in the template

  • The company block with a small logo mark, name, address and tax number.
  • The document title and number, at the top right.
  • A billed-to block with the customer, and the issue and due dates, written in the long form of the reader’s language.
  • A table of line items with quantity, unit price and amount. It grows with your data, and its header row repeats if the table runs onto another page.
  • Subtotal, tax and total, with the currency formatted for the locale.
  • A payment note and a thank-you line.

How to use it

In the portal. Create a free account, click New template and pick the invoice from the gallery. You get a live preview and can edit it with blocks or as code.

From the API. Download the HTML and the sample data and send them in one request. This example uses jq to put both files in the body:

Terminal window
curl -X POST https://api.rustedf.com/v1/render \
-H "Authorization: Bearer $RUSTEDF_KEY" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html invoice.html --slurpfile data invoice-data-en.json \
'{html: $html, data: $data[0], locale: $data[0].locale}')" \
-o invoice.pdf

Once you like the result, save the HTML as a template and call it by its id from your code.

Make it yours

  • Colors. The red bar and the yellow note use plain hex colors in the CSS. Change them to your brand.
  • Logo. Replace the small <svg> with an image. Upload a PNG or JPEG once and use it as <img src="asset:<id>" width="120">.
  • Fonts. The template names Lato and Poppins. Any Google Fonts family works if you put its name in font-family; there is nothing to link.
  • Language. Every label comes from the t object of the data, so you translate the invoice by sending another t. The locale and the currency decide how dates and amounts are written.
  • Amounts. Send them as strings, such as "6480.00". Work the subtotal, the tax and the total out in your own system and send the results.

A note on what an invoice is

This is a commercial invoice layout. The tax and legal requirements for invoices differ by country, and an electronic tax document issued under a national scheme is a different thing. Check what applies to you before you send it to a customer.

See Templates and Locales and formatting.

The template code

<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <style>
      @page { size: A4; margin: 16mm 16mm 14mm 16mm; }
      body { font-family: Lato, sans-serif; font-size: 9.5pt; color: #1b1b1b; line-height: 1.45; }
      h1, h2, .brand, .big { font-family: Poppins, Lato, sans-serif; }
      table { width: 100%; border-collapse: collapse; }
      td, th { vertical-align: top; }

      .top td { padding: 0; }
      .brand { font-size: 17pt; font-weight: bold; letter-spacing: 0.5pt; margin: 0; }
      .muted { color: #666666; }
      .kind { font-family: Poppins, Lato, sans-serif; font-size: 26pt; font-weight: bold; text-align: right; margin: 0; line-height: 1; }
      .number { text-align: right; margin-top: 2mm; color: #666666; }

      .bar { height: 3mm; margin: 7mm 0 7mm 0; background: #d72820; }

      .meta td { padding: 0 6mm 0 0; width: 33%; }
      .label { font-family: Poppins, Lato, sans-serif; font-size: 7pt; font-weight: bold; letter-spacing: 1.2pt; text-transform: uppercase; color: #666666; margin: 0 0 1.2mm 0; }
      .value { font-size: 10pt; margin: 0; }

      .items { margin-top: 9mm; }
      .items th { font-family: Poppins, Lato, sans-serif; font-size: 7.5pt; letter-spacing: 1pt; text-transform: uppercase; text-align: left; padding: 2.4mm 2mm; border-bottom: 2px solid #1b1b1b; }
      .items td { padding: 3mm 2mm; border-bottom: 1px solid #d9d9d9; }
      .items th.right, .right { text-align: right; }
      .desc small { display: block; color: #777777; font-size: 8pt; }

      .totals { margin-top: 6mm; }
      .totals td { padding: 1.6mm 2mm; }
      .totals .grand td { border-top: 2px solid #1b1b1b; padding-top: 3mm; }
      .big { font-size: 15pt; font-weight: bold; }

      .note { margin-top: 12mm; border-left: 3mm solid #f5c518; padding: 2mm 0 2mm 5mm; }
      .note p { margin: 0 0 1.5mm 0; }
      .thanks { margin-top: 10mm; font-family: Poppins, Lato, sans-serif; font-size: 11pt; font-weight: bold; }
    </style>
  </head>
  <body>
    <table class="top">
      <tr>
        <td style="width: 55%">
          <svg width="46" height="16" viewBox="0 0 46 16">
            <circle cx="8" cy="8" r="7" fill="#d72820" />
            <rect x="17" y="1" width="14" height="14" fill="#1d3fa6" />
            <rect x="34" y="1" width="12" height="14" fill="#f5c518" />
          </svg>
          <p class="brand">{{ company.name }}</p>
          <p class="muted">{{ company.line1 }}<br />{{ company.line2 }}<br />{{ company.tax }}</p>
        </td>
        <td>
          <p class="kind">{{ t.title }}</p>
          <p class="number">{{ t.number }} {{ number }}</p>
        </td>
      </tr>
    </table>

    <div class="bar"></div>

    <table class="meta">
      <tr>
        <td>
          <p class="label">{{ t.billed_to }}</p>
          <p class="value"><strong>{{ customer.name }}</strong><br />{{ customer.line1 }}<br />{{ customer.line2 }}</p>
        </td>
        <td>
          <p class="label">{{ t.issued }}</p>
          <p class="value">{{ issued | date(style="long") }}</p>
        </td>
        <td>
          <p class="label">{{ t.due }}</p>
          <p class="value">{{ due | date(style="long") }}</p>
        </td>
      </tr>
    </table>

    <table class="items">
      <thead>
        <tr>
          <th style="width: 50%">{{ t.description }}</th>
          <th class="right" style="width: 12%">{{ t.qty }}</th>
          <th class="right" style="width: 19%">{{ t.unit }}</th>
          <th class="right" style="width: 19%">{{ t.amount }}</th>
        </tr>
      </thead>
      <tbody>
        {% for item in items %}
        <tr>
          <td class="desc">{{ item.name }}<small>{{ item.detail }}</small></td>
          <td class="right">{{ item.qty | number }}</td>
          <td class="right">{{ item.unit | currency(code=currency) }}</td>
          <td class="right">{{ item.amount | currency(code=currency) }}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>

    <table class="totals">
      <tr>
        <td style="width: 55%"></td>
        <td>{{ t.subtotal }}</td>
        <td class="right">{{ subtotal | currency(code=currency) }}</td>
      </tr>
      <tr>
        <td></td>
        <td>{{ t.tax }} ({{ tax_rate | number(digits=0) }}%)</td>
        <td class="right">{{ tax | currency(code=currency) }}</td>
      </tr>
      <tr class="grand">
        <td></td>
        <td class="big">{{ t.total }}</td>
        <td class="right big">{{ total | currency(code=currency) }}</td>
      </tr>
    </table>

    <div class="note">
      <p class="label">{{ t.payment }}</p>
      <p>{{ payment.line1 }}</p>
      <p class="muted">{{ payment.line2 }}</p>
    </div>

    <p class="thanks">{{ t.thanks }}</p>
  </body>
</html>

The sample data

{
  "locale": "en-US",
  "currency": "USD",
  "number": "2025-0142",
  "issued": "2025-03-14",
  "due": "2025-04-13",
  "tax_rate": 8,
  "company": {
    "name": "Aurora Studio",
    "line1": "482 Acacia Street · Austin, TX",
    "line2": "[email protected]",
    "tax": "EIN 12-3456789"
  },
  "customer": {
    "name": "Northwind Traders Inc.",
    "line1": "1500 Congress Avenue, Suite 82",
    "line2": "Austin, TX 78701"
  },
  "items": [
    { "name": "Brand identity", "detail": "Logo, palette and usage guide", "qty": 1, "unit": "2400.00", "amount": "2400.00" },
    { "name": "Packaging design", "detail": "Labels for 6 products", "qty": 6, "unit": "320.00", "amount": "1920.00" },
    { "name": "Product photography", "detail": "Studio day rate", "qty": 2, "unit": "600.00", "amount": "1200.00" },
    { "name": "Company website", "detail": "Hosting for the first year", "qty": 1, "unit": "480.00", "amount": "480.00" }
  ],
  "subtotal": "6000.00",
  "tax": "480.00",
  "total": "6480.00",
  "payment": {
    "line1": "Bank transfer or card before the due date.",
    "line2": "Routing 021000021 · Account 123456789"
  },
  "t": {
    "title": "Invoice",
    "number": "No.",
    "billed_to": "Billed to",
    "issued": "Issued",
    "due": "Due",
    "description": "Description",
    "qty": "Qty",
    "unit": "Unit price",
    "amount": "Amount",
    "subtotal": "Subtotal",
    "tax": "Sales tax",
    "total": "Total",
    "payment": "Payment",
    "thanks": "Thank you for your business."
  }
}

← All posts