business template

Invoice Image API

Send line items and totals as JSON, get back the printable invoice as a 1240x1754 PNG or a paginated A4 PDF.

1240x1754Dimensions
sRGBColor space
Not supportedTransparency
80 KB to 250 KBFile size range

Prefer to try it in your browser first? Open the Invoice Image tool.

Finance teams and billing platforms use the Invoice Image API to turn database rows into styled invoice files without running their own headless browser. Customers want to see the invoice the moment a payment clears, and PNGs embed in email more reliably than PDFs across the major clients. You post party details, line items, and totals as JSON, and the endpoint returns a 1240x1754 PNG hosted on i.html2img.com. Add format: "pdf" to the same request and it returns the invoice as an A4 PDF with selectable text instead.

bash
curl -X POST https://app.html2img.com/api/v1/templates/invoice-image \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"invoice_number":"INV-2026-0042","issue_date":"Apr 30, 2026","due_date":"May 30, 2026","business_name":"Northwind Studio Ltd","business_address":"12 Bishopsgate\nLondon EC2N 4AT\nUnited Kingdom","business_email":"[email protected]","client_name":"Linden & Co","client_address":"548 Market Street\nSan Francisco, CA 94104\nUSA","client_email":"[email protected]","items":[{"description":"Brand identity design","quantity":"1","unit_price":"$4,800.00","amount":"$4,800.00"},{"description":"Landing page build (8 sections)","quantity":"1","unit_price":"$3,200.00","amount":"$3,200.00"},{"description":"Photography retainer","quantity":"6","unit_price":"$420.00","amount":"$2,520.00"}],"subtotal":"$10,520.00","tax_label":"VAT (20%)","tax_amount":"$2,104.00","total":"$12,624.00","notes":"Payment due within 30 days. Wire transfer details on file.","accent_color":"#0F766E"}'

A single cURL call to render a Invoice Image as a PNG. Add "format": "pdf" to the payload to get a PDF instead. For the full PHP, Node and Python equivalents, plus every input the template accepts, see the Invoice Image API reference. Setting up your key is covered in the authentication guide.

API reference

View the Invoice Image API reference: inputs, defaults, error responses and cURL, PHP, Node and Python code samples. Read the docs.

Invoice Image template preview, a business image generated by the HTML to Image API
Invoice Image 1240x1754

Use cases

Transactional email receipts at Northwind Studio

When a customer card charges successfully, your billing service already holds the line items and totals. Post them to the endpoint and drop the returned URL into an <img> tag in the receipt email. Customers see the styled invoice inline without downloading a PDF or waiting for an attachment to expand. Postmark, Resend, and Mailgun all accept remote PNG URLs, so the asset never touches your outbound mail server. Inbox open rates on receipt emails climb when the invoice renders without a click.

Customer dashboard invoice previews

Show the upcoming invoice on the billing tab of your dashboard before the renewal charges. Render the projected line items, plan amounts, and tax to a PNG, then drop the URL into the React component as an <img>. The dashboard stays snappy because the browser is loading one cached image, not running a layout pass over a complex billing table. Riverside Bakery uses this pattern to give franchise owners a one-glance view of their March numbers without writing dashboard CSS.

Accounting platform OCR ingestion

Connector platforms that move data from a SaaS into Xero or QuickBooks need a stable image of the source invoice. Render the invoice once at issue time, store the PNG URL, and let the OCR job process it on a schedule. Because the layout is consistent across renders, the OCR confidence scores stay high and you avoid the manual matching queue. Halberd Software ships connectors for 14 SaaS tools using this exact flow, with one ingestion path that does not care which app produced the bill.

Marketplace seller commission statements

Two-sided marketplaces owe sellers detailed statements every payout cycle. Generate one styled PNG per seller per cycle from your already-computed payout rows. Sellers receive a single image that opens on mobile without zooming, embeds in WhatsApp without breaking, and prints to A4 if they need a physical copy for their accountant. Wren Analytics processes 8,400 seller statements monthly through this flow, replacing a queued PDF generator that often timed out.

Subscription tools showing the next invoice

Self-serve plan-change pages benefit from showing the prorated next invoice before the user clicks confirm. Build the line items in PHP, post to the endpoint, and embed the PNG above the confirm button. Conversion on plan upgrades climbs when buyers see exactly what they will be charged, with the same visual treatment as the receipts they already trust. The image takes around 1.4 seconds to render, well inside the page-load budget for an interactive flow.

Output specifications

Dimensions
1240x1754
Color space
sRGB
Transparency
Not supported
File size range
80 KB to 250 KB

Matches the spec at ISO 216 A4 portrait at 150 DPI.

These specifications describe the default PNG output. The template can also return a PDF document with selectable text through the HTML to PDF API: set format to pdf in the request. See the format parameter docs for how PDF output behaves.

How it works

1

Send a JSON payload

POST to the template endpoint with the values you want rendered. Authenticate with your API key.

2

We render the image

The template is rendered server-side as a 1240x1754 PNG, or as a PDF document if you set format to pdf.

3

You get back a URL

Cache it, embed it in your page, attach it to an email.

Common pitfalls

VAT label localization

A US merchant ships an invoice to a UK customer with a "Sales Tax" line, and the buyer files it as the wrong category. Send tax_label as a per-customer string ("VAT (20%)", "GST (10%)", "Sales Tax") so the rendered PNG matches the buyer's tax regime.

Long line item descriptions wrap awkwardly

A 180-character description of a custom service spills onto three lines and pushes the totals block off the page. Keep descriptions under 80 characters or split them across two adjacent rows so the PDF-style A4 layout holds together.

Currency formatting drift across locales

You save raw decimals in the database and let the renderer format them, then realize "1,290.00" displays where European customers expect "1.290,00". Pre-format every monetary string on your side using the buyer's locale before posting to the endpoint.

Inputs at a glance

A quick summary of what the Invoice Image template accepts. The full reference, with example values and array shapes, is in the docs.

Name Type Required
invoice_number string Required
issue_date string Optional
due_date string Optional
business_name string Required
business_address string Optional
business_email string Optional
client_name string Required
client_address string Optional
client_email string Optional
items array Required
subtotal string Optional
tax_label string Optional
tax_amount string Optional
total string Required
notes string Optional
logo_url url Optional
accent_color string Optional

See the full inputs reference for descriptions, examples and validation rules.

Related templates

Other templates in the business and commerce category.

Browse by category

A starting point from each of the other two template categories.

See the full template gallery for every design grouped by category.

Related guides

FAQ

What size is the rendered invoice?

The output is a 1240x1754 PNG, which is A4 portrait at 150 DPI. The file embeds in email at full width and prints clean to a physical A4 sheet without scaling artifacts. File size lands between 80 KB and 250 KB depending on logo and table density.

Should I use a PDF or an image?

The endpoint produces both from the same payload: the default output is a PNG, and format: "pdf" returns an A4 PDF with selectable text and embedded fonts. Use the PNG inline in email bodies, dashboards, and chat, where images display without a click. Send the PDF where the recipient will print, sign, search, or file the invoice.

How are multiple currencies handled?

You format every monetary string on your side before posting. The endpoint treats each amount as a string, so "$1,290.00", "€1.290,00", or "¥129,000" render exactly as written. This keeps the rendering layer free of currency logic and avoids drift between your billing system and the displayed invoice.

How many line items can I include?

In PNG output, invoices over 30 line items begin to overflow the single A4 page, so split very long bills if you need images. With format: "pdf" there is no practical ceiling: the line item table paginates across pages automatically and the totals block follows the final row.

Can I add my company logo?

Yes, pass logo_url with a public URL to a PNG or SVG. The renderer fetches the image during the layout pass and places it in the header block. Use a transparent PNG for cleanest results on the off-white invoice background.

Does it support multi-page invoices?

Yes, as a PDF. Pass format: "pdf" and a long invoice flows across as many A4 pages as its line items need, with no extra parameters. The PNG output remains a single page, so pick the PDF for bills that outgrow one sheet.

Try it free

50 free renders on the free tier, no card. See the pricing page for higher-volume plans.