rustedf.cloud
Menu

Free modern invoice template with a colored header, HTML to PDF

Published 2 min read

Free modern invoice template as a PDF: a dark navy header, rounded detail cards, striped rows and an orange total

Free template

Use this template for free

Create a free account, make a new template in the Code mode and paste the HTML below. Then send your own data from the API.

Download the HTMLDownload the sample data

This is the modern style: a dark header band across the top of the page, soft rounded cards for the details, striped rows in the table and one accent color for the total. It is a complete invoice you can use as it is or change: 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 name, address and tax number.
  • The document title and number.
  • 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, switch to the Code mode and paste the HTML below. You get a live preview.

From the API. Download the HTML and the sample data and send both in one request. This example uses jq to put the 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-modern.html --slurpfile data invoice-modern-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

  • Look. The navy band is #1f2a44 and the accent is #f28c28, both plain hex colors in the CSS. Change the two and the whole document follows.
  • 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.
  • Logo. Add your logo as <img src="asset:<id>" width="120"> after uploading a PNG or JPEG once.
  • Fonts. The template names PT Sans, and any Google Fonts family works by name; there is nothing to link.
  • Language. Every label comes from the t object of the data, so the same template issues documents in any language you can write.

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.

Other styles

The same data works with the other styles of this document:

See Templates / Locales and formatting.

The template code

<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <style>
      @page { size: A4; margin: 0 0 14mm 0; }
      body { margin: 0; font-family: "PT Sans", sans-serif; font-size: 10pt; color: #1f2a44; line-height: 1.45; }
      table { width: 100%; border-collapse: collapse; }
      td, th { vertical-align: top; }
      p { margin: 0; }
      .muted { color: #6b7488; }
      .right { text-align: right; }

      .top { background: #1f2a44; color: #ffffff; padding: 14mm 18mm 12mm 18mm; }
      .top .name { font-size: 17pt; font-weight: bold; }
      .top .info { color: #b8c0d4; font-size: 9pt; margin-top: 1.5mm; }
      .kind { font-size: 24pt; font-weight: bold; text-align: right; color: #f28c28; letter-spacing: 1pt; text-transform: uppercase; }
      .ref { text-align: right; color: #b8c0d4; margin-top: 1.5mm; }

      .content { padding: 10mm 18mm 0 18mm; }
      .card { background: #f1f3f8; border-radius: 3mm; padding: 4mm 5mm; }
      .label { font-size: 8pt; font-weight: bold; letter-spacing: 1.2pt; text-transform: uppercase; color: #f28c28; margin-bottom: 1.5mm; }

      .items { margin-top: 9mm; }
      .items th { background: #1f2a44; color: #ffffff; text-align: left; font-size: 8.5pt; text-transform: uppercase; letter-spacing: 0.8pt; padding: 3mm 3mm; }
      .items td { padding: 3mm 3mm; }
      .items tbody tr:nth-child(even) td { background: #f6f7fb; }
      .items small { display: block; color: #6b7488; font-size: 8.5pt; }

      .totals { width: 50%; margin-left: 50%; margin-top: 5mm; }
      .totals td { padding: 2mm 3mm; }
      .grand td { background: #f28c28; color: #ffffff; font-size: 12pt; font-weight: bold; padding: 3.5mm 3mm; }

      .pay { margin-top: 9mm; }
      .thanks { margin-top: 8mm; font-weight: bold; }
      .items th.right { text-align: right; }
    </style>
  </head>
  <body>
    <div class="top">
      <table>
        <tr>
          <td style="width: 58%">
            <p class="name">{{ company.name }}</p>
            <p class="info">{{ company.line1 }}<br />{{ company.line2 }}<br />{{ company.tax }}</p>
          </td>
          <td>
            <p class="kind">{{ t.title }}</p>
            <p class="ref">{{ t.number }} {{ number }}</p>
          </td>
        </tr>
      </table>
    </div>

    <div class="content">
      <table>
        <tr>
          <td style="width: 48%; padding-right: 4mm">
            <div class="card">
              <p class="label">{{ t.billed_to }}</p>
              <p><strong>{{ customer.name }}</strong><br />{{ customer.line1 }}<br />{{ customer.line2 }}</p>
            </div>
          </td>
          <td style="width: 26%; padding-right: 4mm">
            <div class="card">
              <p class="label">{{ t.issued }}</p>
              <p>{{ issued | date(style="long") }}</p>
            </div>
          </td>
          <td>
            <div class="card">
              <p class="label">{{ t.due }}</p>
              <p>{{ due | date(style="long") }}</p>
            </div>
          </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>{{ 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 class="muted">{{ t.subtotal }}</td>
          <td class="right">{{ subtotal | currency(code=currency) }}</td>
        </tr>
        <tr>
          <td class="muted">{{ t.tax }} ({{ tax_rate | number(digits=0) }}%)</td>
          <td class="right">{{ tax | currency(code=currency) }}</td>
        </tr>
        <tr class="grand">
          <td>{{ t.total }}</td>
          <td class="right">{{ total | currency(code=currency) }}</td>
        </tr>
      </table>

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

      <p class="thanks">{{ t.thanks }}</p>
    </div>
  </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