Beautiful PDF Invoice Template: HTML + CSS to PDF Tutorial

Professional Invoices from HTML Generating invoices is one of the most common PDF use cases. Instead of wrestling with PDF libraries that use coordinates and drawing commands, you can design invoices with familiar HTML and CSS, then convert them to pixel-perfect PDFs. This tutorial gives you a complete, production-ready invoice template and shows how to generate PDFs with the ToolCenter. The Invoice Template Here’s a clean, professional invoice template: <!DOCTYPE html> <html> <head> <style> @page { size: A4; margin: 0; } * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Helvetica Neue', Arial, sans-serif; color: #333; font-size: 14px; } .invoice { padding: 50px; max-width: 800px; margin: 0 auto; } /* Header */ .invoice-header { display: flex; justify-content: space-between; margin-bottom: 50px; } .company-info h1 { font-size: 28px; color: #2c3e50; margin-bottom: 5px; } .company-info p { color: #7f8c8d; font-size: 13px; line-height: 1.6; } .invoice-title { text-align: right; } .invoice-title h2 { font-size: 36px; color: #3498db; text-transform: uppercase; letter-spacing: 2px; } .invoice-title .invoice-number { font-size: 16px; color: #7f8c8d; margin-top: 5px; } /* Details Grid */ .invoice-details { display: flex; justify-content: space-between; margin-bottom: 40px; } .detail-block h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #95a5a6; margin-bottom: 8px; } .detail-block p { line-height: 1.6; } /* Table */ .invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; } .invoice-table th { background: #3498db; color: white; padding: 12px 15px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; } .invoice-table th:last-child { text-align: right; } .invoice-table td { padding: 12px 15px; border-bottom: 1px solid #ecf0f1; } .invoice-table td:last-child { text-align: right; } .invoice-table .item-desc { font-size: 12px; color: #95a5a6; } /* Totals */ .invoice-totals { display: flex; justify-content: flex-end; } .totals-table { width: 280px; } .totals-table .row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #ecf0f1; } .totals-table .total { font-size: 18px; font-weight: bold; color: #2c3e50; border-bottom: 3px solid #3498db; padding: 12px 0; } /* Footer */ .invoice-footer { margin-top: 60px; padding-top: 20px; border-top: 1px solid #ecf0f1; text-align: center; color: #95a5a6; font-size: 12px; } /* Payment Info */ .payment-info { background: #f8f9fa; border-radius: 8px; padding: 20px; margin-top: 30px; } .payment-info h3 { font-size: 14px; color: #2c3e50; margin-bottom: 10px; } .payment-info p { font-size: 13px; color: #666; line-height: 1.6; } </style> </head> <body> <div class="invoice"> <div class="invoice-header"> <div class="company-info"> <h1>Acme Corp</h1> <p>123 Business Street<br>San Francisco, CA 94102<br>[email protected]</p> </div> <div class="invoice-title"> <h2>Invoice</h2> <div class="invoice-number">#INV-2026-0042</div> </div> </div> <div class="invoice-details"> <div class="detail-block"> <h3>Bill To</h3> <p><strong>Client Name</strong><br>456 Client Ave<br>New York, NY 10001<br>[email protected]</p> </div> <div class="detail-block"> <h3>Invoice Date</h3> <p>February 19, 2026</p> <h3 style="margin-top:15px;">Due Date</h3> <p>March 19, 2026</p> </div> </div> <table class="invoice-table"> <thead> <tr> <th>Description</th> <th>Qty</th> <th>Rate</th> <th>Amount</th> </tr> </thead> <tbody> <tr> <td>Web Development Services<br><span class="item-desc">Frontend implementation — React</span></td> <td>40 hrs</td> <td>$150.00</td> <td>$6,000.00</td> </tr> <tr> <td>UI/UX Design<br><span class="item-desc">Dashboard redesign</span></td> <td>20 hrs</td> <td>$125.00</td> <td>$2,500.00</td> </tr> <tr> <td>API Integration<br><span class="item-desc">Third-party payment gateway</span></td> <td>15 hrs</td> <td>$175.00</td> <td>$2,625.00</td> </tr> </tbody> </table> <div class="invoice-totals"> <div class="totals-table"> <div class="row"><span>Subtotal</span><span>$11,125.00</span></div> <div class="row"><span>Tax (10%)</span><span>$1,112.50</span></div> <div class="row total"><span>Total</span><span>$12,237.50</span></div> </div> </div> <div class="payment-info"> <h3>Payment Information</h3> <p>Bank: First National Bank | Account: 1234567890 | Routing: 021000021<br> Please include invoice number in the payment reference.</p> </div> <div class="invoice-footer"> <p>Thank you for your business! | Questions? Contact [email protected]</p> </div> </div> </body> </html> Generating the PDF Node.js const axios = require('axios'); const fs = require('fs'); async function generateInvoice(invoiceHtml) { const response = await axios.post( 'https://api.toolcenter.dev/v1/pdf', { html: invoiceHtml, format: 'A4', printBackground: true, margin: { top: '0mm', bottom: '0mm', left: '0mm', right: '0mm' }, }, { headers: { 'Authorization': 'Bearer YOUR_API_KEY' }, responseType: 'arraybuffer', } ); return Buffer.from(response.data); } // Generate and save const html = fs.readFileSync('./invoice-template.html', 'utf-8'); const pdf = await generateInvoice(html); fs.writeFileSync('invoice-2026-0042.pdf', pdf); Python import requests def generate_invoice(html): response = requests.post( 'https://api.toolcenter.dev/v1/pdf', json={ 'html': html, 'format': 'A4', 'printBackground': True, 'margin': {'top': '0mm', 'bottom': '0mm', 'left': '0mm', 'right': '0mm'}, }, headers={'Authorization': 'Bearer YOUR_API_KEY'} ) return response.content with open('invoice-template.html') as f: html = f.read() pdf = generate_invoice(html) with open('invoice.pdf', 'wb') as f: f.write(pdf) Making It Dynamic Use a template engine to populate invoices with real data: ...

February 19, 2026 · 5 min · ToolCenter Team

Test Responsive Design with Mobile Screenshots API

Why Mobile Screenshots Matter Over 60% of web traffic comes from mobile devices. If your site looks broken on a phone, you’re losing customers. Manual testing on every device is impractical — there are hundreds of screen sizes to consider. Automated mobile screenshots let you verify responsive layouts at every breakpoint without touching a physical device. Common Mobile Viewports Here are the key viewport sizes to test: Device Width Height Scale iPhone SE 375 667 2x iPhone 14 390 844 3x iPhone 14 Pro Max 430 932 3x Samsung Galaxy S23 360 780 3x iPad Mini 768 1024 2x iPad Pro 12.9" 1024 1366 2x Basic Mobile Screenshot Capture a screenshot at a mobile viewport using the ToolCenter: ...

February 19, 2026 · 5 min · ToolCenter Team

Automate Report Generation: From Data to PDF in Minutes

Why Automate Report Generation? Every business generates reports: sales summaries, analytics dashboards, client deliverables, compliance documents. Doing this manually means hours of copy-pasting data into templates, adjusting formatting, and exporting PDFs. With the ToolCenter HTML-to-PDF API, you can turn any HTML template into a polished PDF in a single API call. Feed it data, get a report. The Architecture The workflow is straightforward: Fetch your data — Database query, API call, or spreadsheet Render HTML template — Inject data into an HTML template Convert to PDF — Send the HTML to ToolCenter Deliver — Email, upload to S3, or serve to users Step 1: Design Your Report Template Create a professional HTML report template: ...

February 18, 2026 · 5 min · ToolCenter Team

Dark Mode Screenshots: How to Capture Websites in Dark Theme

Why Dark Mode Screenshots? Dark mode has gone mainstream. Most popular websites and apps now support it, and many users prefer it. If you’re capturing screenshots for documentation, marketing materials, or visual testing, you need to capture both light and dark mode variants. The challenge? Programmatically telling a website to render in dark mode isn’t as simple as toggling a switch. How Dark Mode Works on the Web Websites implement dark mode using the CSS prefers-color-scheme media query: ...

February 18, 2026 · 5 min · ToolCenter Team

Build a URL Shortener with QR Codes: Step-by-Step Tutorial

What We’re Building A URL shortener that automatically generates a QR code for every shortened link. Users paste a long URL, get a short link, and can download a QR code that points to it. We’ll use Node.js with Express for the backend and the ToolCenter QR Code API for generating QR codes. Prerequisites Node.js 18+ installed A ToolCenter key Basic knowledge of Express.js Project Setup mkdir url-shortener-qr cd url-shortener-qr npm init -y npm install express nanoid Project Structure u ├ ├ │ └ r ─ ─ ─ l ─ ─ ─ - s s p └ p h e u ─ a o r b ─ c r v l k t e i i a e r c n g n . / d e e j e . r s x j - . s q h o r t n / m l Step 1: Build the Server Create server.js: ...

February 17, 2026 · 5 min · ToolCenter Team

Headless Chrome vs Screenshot API: Which Should You Use?

The Screenshot Dilemma You need to capture website screenshots programmatically. Maybe it’s for link previews, visual testing, or monitoring. You have two paths: run your own headless Chrome setup or use a managed Screenshot API. Both work. But the right choice depends on your scale, budget, and tolerance for operational headaches. Option 1: Self-Hosted Headless Chrome Headless Chrome runs a full browser without a visible window. Libraries like Puppeteer (Node.js) and Playwright (multi-language) provide APIs to control it. ...

February 16, 2026 · 5 min · ToolCenter Team

Web Scraping vs APIs: When to Use Each (2026 Guide)

The Data Extraction Dilemma Every developer eventually needs to pull data from the web. Whether it’s monitoring competitor prices, aggregating content, or building a search engine, you have two main options: web scraping and APIs. Each approach has strengths and trade-offs. This guide helps you decide which to use — and when to combine them. What Is Web Scraping? Web scraping means programmatically extracting data from web pages by parsing their HTML. You send HTTP requests, receive HTML responses, and pull out the data you need. ...

February 16, 2026 · 5 min · ToolCenter Team

Automate Social Media Cards: Generate Twitter/LinkedIn Previews

Why Social Media Cards Matter When someone shares your link on Twitter, LinkedIn, or Facebook, the platform fetches your Open Graph (OG) metadata and renders a preview card. A well-designed card can increase click-through rates by 2-3x compared to a plain text link. The problem? Manually creating unique OG images for every page is tedious. If you have hundreds of blog posts, product pages, or landing pages, you need automation. ...

February 15, 2026 · 4 min · ToolCenter Team

How to Block Cookie Banners in Automated Screenshots

Cookie consent banners are the bane of automated screenshots. You set up a beautiful monitoring pipeline, and every screenshot has a giant popup covering half the page. In this guide, we will explore multiple techniques to block, hide, or dismiss cookie banners in automated screenshots. Why Cookie Banners Are a Problem Since GDPR and similar privacy regulations, nearly every website displays a cookie consent banner on first visit. For automated screenshot tools, every visit is a first visit because there are no stored cookies. This means: ...

February 14, 2026 · 5 min · ToolCenter Team

7 Best Free QR Code Generators in 2026

QR codes are everywhere in 2026 — from restaurant menus and product packaging to digital business cards and event tickets. Choosing the right QR code generator can save you time, money, and headaches. We tested and compared the 7 best free QR code generators available today, evaluating them on features, customization, tracking, and API access. What to Look for in a QR Code Generator Before diving into the comparison, here are the key features that matter: ...

February 13, 2026 · 5 min · ToolCenter Team