To generate a PDF invoice from HTML, render a populated invoice template with a PDF-capable browser such as Chromium through Puppeteer or Playwright. Add print-specific CSS, wait until invoice data and assets are ready, choose paper dimensions and margins, then inspect the resulting PDF—especially invoices with enough line items to span multiple pages. If your template does not need JavaScript, WeasyPrint is another option.
Choose a renderer that matches your invoice
PDF generation is a rendering step: the renderer lays out the HTML and CSS for a page and writes the result to a PDF. Your choice depends mainly on whether the invoice requires JavaScript, how closely it must match browser rendering, and what runtime your application can support.
As an Amazon Associate I earn from qualifying purchases.
| Option | Useful when | Documented behavior and constraint |
|---|---|---|
| Puppeteer with Chromium | The invoice relies on browser behavior or modern web layout, and a Node.js browser-automation route suits deployment. | Puppeteer’s PDF guide says Page.pdf() uses print CSS media by default and waits for fonts by default. |
| Playwright with Chromium | Your application already uses Playwright or you want its documented page PDF options. | Playwright’s Page API documents a PDF buffer, print CSS media by default, paper formats such as Letter and A4, and header/footer templates. The cited PDF export interface is Chromium-only; see Playwright PDF Export. |
| WeasyPrint | The invoice can be represented in HTML and CSS without executing JavaScript. | The WeasyPrint project website says it does not execute JavaScript. Its API reference describes PDF hyperlinks, bookmarks, attachments, and forms. Confirm support in the version you deploy. |
Compare candidates on JavaScript needs, browser fidelity, print CSS support, deployment runtime and footprint, asset loading, page-break behavior, PDF features, and ongoing maintenance. The documentation cited here does not establish a performance benchmark or cost comparison.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsBuild the invoice as structured data plus a template
Keep validated invoice data and calculations separate from presentation. Calculate line totals, taxes, discounts, and the amount due in application logic; pass the resulting values to a semantic HTML template. Styling should not determine financial values.
#1 Best Overall
- Two-Part Carbonless Invoice Book: Each invoice book has 50 sets of invoices, each with a white/light yellow section, with the yellow section retained in the invoice book to maintain detailed records.
- Consecutively Numbered: Enlarged red 6-digit numbers in the upper right corner of each invoice receipt book help you quickly navigate through your orders.
- Wraparound Divider Flap: A thick folded cardboard divider is integrated into the back of each invoice book for use between each two-part sales order to prevent the written content from rubbing off on subsequent copies of the invoice, resulting in wasted invoices.
- 2 Packs/50 Sets (100 Sets Total): Each invoice book provides 50 sequentially numbered carbonless sets of 2 invoice books for long-term use.
- Customizable Space: Each invoice book for small business has space at the top to add a company seal or sticker.
A template might contain a heading for the seller and invoice number, a customer block, dates and payment terms, and a line-items table with a header row and a totals section. Use meaningful text and table structure so content remains understandable and can be laid out predictably. Make sure the template handles optional fields and long names or descriptions without overflowing the page.
Renderer documentation does not define which invoice fields, tax disclosures, numbering rules, electronic-invoicing requirements, or retention periods apply to your business. Check official tax or government guidance for the relevant jurisdiction and circumstances before relying on the PDF operationally.
Rank #2
- QUALITY INVOICES: Adams Order books provide a professional invoice or customer receipt; a great way to create and maintain a professional image for small businesses and service providers
- 50 TWO-PART CARBONLESS FORMS: Customers get the perforated white top copy; retain the canary and pink copies for your records
- WRAP-AROUND COVER: Fold the back cover between sets to keep invoices neat and legible
- ROOM FOR CUSTOMIZATION: A blank space at top leaves room for your company stamp; a big savings over custom-printed forms
- CONSECUTIVELY NUMBERED: Large 6-digit numbers in the upper right hand corner help you thumb through orders quickly
Add print CSS before generating the PDF
Browser PDF APIs use print media by default, so create a dedicated @media print stylesheet rather than assuming the screen view will paginate correctly. Set the intended paper size and margins in CSS or through the renderer’s options, and check which setting takes precedence in your chosen setup.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
@media print {
@page {
size: A4;
margin: 14mm;
}
body {
margin: 0;
color: #111;
font: 10pt/1.4 Arial, sans-serif;
}
thead {
display: table-header-group;
}
tr,
.invoice-totals {
break-inside: avoid;
}
}
This is a starting point, not a guarantee that every renderer will repeat headers or keep every row together. Verify page-break behavior in the renderer and version you deploy. Avoid setting a fixed page height on content that can grow, and make long descriptions, totals, and footers fit without clipping.
Rank #3
- PACKAGE INCLUDES - Our invoice book per pack has 50 sets sheets, total in 2 pack, Total of 200 sheets. red code printed on each page with consecutive numbers
- Material - Receipt book is excellent quality carbonless paper is used in their production, tears off easily along the perforation.
- A5 Size - Sales invoice book size of 5.5" x 8.5", and forms are 2 part carbonless white/yellow sets on a sturdy chipboard backing
- WIDE APPLICATION - Sales reciepts/invoice book for small business is ideal for restaurants, food trucks, vendors, service provider, photographers, caterers, florists, bakeries, cafes, boutiques and salons
Generate the PDF with Puppeteer
The following Node.js example opens an invoice URL, waits for the page to finish loading, then saves a PDF using the page’s print styles. Replace the URL with a route that serves the invoice for the intended customer and invoice data. Protect that route so invoice information is not exposed publicly.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto('http://localhost:3000/invoices/INV-1042', {
waitUntil: 'networkidle0',
});
await page.pdf({
path: 'invoice-INV-1042.pdf',
format: 'A4',
printBackground: true,
margin: {
top: '14mm',
right: '14mm',
bottom: '14mm',
left: '14mm',
},
});
} finally {
await browser.close();
}
Page.pdf() uses print CSS media by default. Puppeteer’s guide says it waits for fonts by default, but that does not by itself ensure that every remote image, application update, or data-dependent element is ready. Wait for the relevant invoice state in your app when needed. The code uses Puppeteer’s documented API; check the current guide for version-specific options at the PDF generation guide.
Rank #4
- 2-PART & 3-PART CARBONLESS COPIES Choose 2-Part White/Yellow or 3-Part White/Yellow/Pink carbonless forms. Each receipt book with carbon copies creates clear, readable copies as you write, making it easy to provide a customer copy while keeping organized records for your business.
- FULLY CUSTOMIZED FOR YOUR BUSINESS Personalize your custom receipt book with your company name, contact information, full-color logo or artwork, starting number, and business details. Create professional business forms that match your brand and are easy for customers to recognize.
- TWO SIZES WITH SEQUENTIAL NUMBERING Available in 5.5" × 8.5" and 8.5" × 11" sizes to fit different business needs. Sequential numbering helps keep invoices, payments, work orders, and customer records organized, and you can select your preferred starting number when customizing.
- MADE FOR EVERYDAY BUSINESS USE Designed for contractors, mechanics, repair shops, retail stores, delivery services, salons, offices, and other small businesses. Use it as an invoice book, mechanic invoice book, contractor invoice book, invoice receipt book, work order form, estimate, or payment receipt book.
- PROFESSIONAL FORMS BUILT FOR DAILY RECORDKEEPING A practical invoice book with carbon copies featuring a clean, easy-to-read layout and kraft cover for everyday business use. Whether you need invoices for business, customer receipts, service records, or sales forms, these books help keep transactions clear, professional, and easy to track.
Generate the PDF with Playwright
If your project already uses Playwright, create the PDF from a Chromium page. This example uses the same locally served invoice route and returns a buffer that you can write to disk or pass to your storage or delivery layer.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →import { chromium } from 'playwright';
import { writeFile } from 'node:fs/promises';
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto('http://localhost:3000/invoices/INV-1042', {
waitUntil: 'networkidle',
});
const pdf = await page.pdf({
format: 'A4',
printBackground: true,
margin: {
top: '14mm',
right: '14mm',
bottom: '14mm',
left: '14mm',
},
});
await writeFile('invoice-INV-1042.pdf', pdf);
} finally {
await browser.close();
}
Playwright documents print CSS media as the default for page.pdf(). Its options also include paper formats and header/footer templates; use those only if they fit your design, and check the API for the deployed version at the Page API reference. The cited PDF export interface is Chromium-only, so confirm the browser and runtime you will actually deploy.
Best Value
- EFFICIENT 2-PART CARBONLESS SYSTEM WITH 50 SETS – This contractor invoice book 2 part contains 50 sets of white and yellow carbonless forms, creating instant duplicates with no messy carbon paper. Perfect for on-the-job billing, it serves as a reliable invoice receipt book for small business owners who need clean, professional copies for customers and records.
- PROFESSIONAL SIZE & DURABLE COVER – Measuring 7.3" x 11", each page provides ample writing space for labor, materials, and job details. The 250g coated paper cover resists wear on job sites, making this contractors invoice book a durable choice for electricians, plumbers, and general contractors.
- SEQUENTIALLY NUMBERED & PERFORATED – Pre-numbered pages help track every transaction, while the top perforated tear line allows for clean, easy removal. Whether used as contractor invoice forms or work order receipt book pages, the organized layout reduces errors and saves time.
- STURDY CARDBOARD BACKING FOR ON-SITE USE – Built-in bottom cardboard backing provides a firm writing surface anywhere—no desk required. Ideal for work order estimate forms or contractor estimate book applications, this feature ensures legible copies even in trucks or trailers.
- VERSATILE FOR MULTIPLE BUSINESS TYPES – Works seamlessly as invoice receipt book 2 part for contractors, work order estimate forms for repair shops, or contractor estimate book for service professionals. From construction and landscaping to HVAC and handyman services, this invoice receipt book for small business adapts to any industry that needs professional on-site billing.
Use WeasyPrint when JavaScript is not required
WeasyPrint can turn HTML and CSS into a PDF without running a browser automation flow. It is a reasonable candidate for a template whose content is already server-rendered and whose layout does not depend on JavaScript. It is not suitable when your invoice page must execute JavaScript to populate or modify the document. Review the project’s current JavaScript limitation and API reference for supported behavior in your chosen version.
Check assets, page breaks, and output before delivery
- Wait for invoice data. Do not start rendering until the page shows the completed invoice, including computed values.
- Confirm fonts and images. Browser PDF export can wait for fonts according to Puppeteer’s guide, but verify that remote images and other required assets load in your actual flow.
- Set paper and margins deliberately. Choose A4, Letter, or the required format, then check printable space for headers, footers, and totals.
- Test short and long invoices. Include a case with enough rows to cross a page boundary, as well as long descriptions, unusual characters, discounts, and taxes.
- Inspect the actual PDF. Look for clipped text, awkward page splits, unreadable type, missing assets, incorrect totals, and working links. Treat repeated table headings and row-breaking rules as behaviors to verify, not universal guarantees.
- Validate business requirements separately. Confirm invoice content and record-retention obligations with the relevant official guidance for the jurisdiction and business circumstances.
Troubleshoot common PDF invoice problems
- JavaScript-populated fields are blank: the page may have been printed before the application finished rendering, or the chosen renderer may not execute JavaScript. Wait for an app-specific ready signal; if using WeasyPrint, render the data into HTML before conversion.
- Fonts or images are missing: check asset URLs, authentication, network access, and load completion in the rendering environment. Ensure the invoice does not rely on a local asset path unavailable to the deployed process.
- Text is clipped or pages break badly: inspect print-specific widths, margins, long unbreakable strings, and row behavior. Test the exact renderer with a multi-page invoice rather than assuming CSS page-break rules behave identically everywhere.
- The PDF differs from the browser screen: PDF methods use print media by default. Check your
@media printrules and any print-specific browser options. - PDF export is unavailable in the selected Playwright browser: the cited PDF export interface is Chromium-only. Use Chromium for that flow or choose a renderer that fits your runtime.
- A document looks correct but may not meet invoicing rules: appearance does not establish legal or tax compliance. Verify mandatory content and retention rules with official guidance for the applicable jurisdiction.
Or skip the browser setup
If you only need to render an HTML invoice page as a PDF, ScreenshotNeo accepts a URL in one GET request. Its PDF API can be called like this; replace the example URL with an invoice URL that the service can access. See the ScreenshotNeo documentation for PDF options and request details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.pdf
ScreenshotNeo accepts cookie or consent banners as a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Learn about ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.
Frequently Asked Questions
Does generating a PDF make an invoice legally compliant?
No. The renderer creates a document; required invoice fields, tax treatment, numbering, and retention rules depend on jurisdiction and business circumstances. Check the applicable official guidance.
Can WeasyPrint render a JavaScript-generated invoice?
No. The WeasyPrint project website says it does not execute JavaScript. Render the invoice data into HTML first or choose a JavaScript-capable browser renderer.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Free tools Windows power users keep installed
One-click scans. No signup required.




