How to Multi Page PDF Templates
Complex documents — multi-page invoices, catalog booklets, reports with cover pages and appendices — require templates that handle pagination, repeating headers, dynamic page counts, and content that flows naturally across page breaks. SublimePDF renders multi-page PDFs from a single HTML template, letting CSS and content length determine the page count dynamically.
Follow the step-by-step instructions below, then use the free tool directly — no registration or download required.
Open Tool →How to Multi Page PDF Templates — Step by Step
Structure your template with semantic sections
Organize your HTML into distinct sections: cover page, table of contents, body content, and appendices. Use <section> or <div> elements with descriptive classes (class='cover-page', class='report-body') to logically separate each part.
Force page breaks between sections
Apply break-before: page or break-after: page in CSS to start each major section on a new page. Example: .cover-page { break-after: page; } ensures the content after the cover starts on page two.
Prevent orphaned content
Use break-inside: avoid on elements that should stay together — table rows, figure/caption pairs, address blocks, and list items. This prevents a heading from appearing at the bottom of one page with its content starting on the next.
Create repeating table headers
For long tables spanning multiple pages, use <thead> with display: table-header-group and <tfoot> with display: table-footer-group. The browser automatically repeats these on every page the table spans.
Add dynamic page numbers
Use SublimePDF's header/footer template with <span class='pageNumber'></span> and <span class='totalPages'></span> to display running page numbers. Set displayHeaderFooter: true and provide adequate top/bottom margins.
Handle variable-length content
Let content flow naturally across pages rather than trying to calculate page breaks manually. Use min-height on sections to ensure they fill at least one page when needed, and let CSS handle overflow onto additional pages.
Pro Tips
- 💡 Use page-break-before: always on section headings to guarantee each chapter starts on a new page, even if the previous chapter ends mid-page.
- 💡 For catalogs with product cards, use CSS Grid or Flexbox with break-inside: avoid on each card — this keeps cards intact across page boundaries.
- 💡 Set @page size explicitly rather than relying on defaults: @page { size: A4 portrait; } ensures consistent output regardless of the API consumer's locale settings.
- 💡 Test with varying data volumes — your template should look good with 3 items and 300 items. Dynamic pagination means the PDF grows gracefully with content.
Privacy & Security
All processing happens directly in your browser. Your files are never uploaded to any server — they remain on your device throughout the entire process. SublimePDF uses WebAssembly technology for fast, secure, client-side processing.
Works Everywhere
This tool works on any modern browser — Chrome, Firefox, Safari, or Edge — on desktop, tablet, or mobile. No software to install. PDF is an open ISO standard supported by all major platforms.
How to Multi Page PDF Templates — FAQ
How many pages can a single template generate?
Can I have landscape and portrait pages in the same PDF?
How do I create a table of contents with page numbers?
Why does my PDF have an extra blank page at the end?
Related Guides
How to Convert HTML To PDF
Converting HTML to PDF is a core workflow for developers, marketers, and anyone who needs a permanent, printable snapshot of web content. Whether you're archiving a webpage, generating reports from a web app, saving receipts from online purchases, or creating documentation from HTML templates, PDF conversion captures the visual layout, links, and styling in a portable format.
How to Generate PDF From Json
Generating PDFs from structured JSON data is the backbone of automated document workflows — invoices from order data, reports from analytics payloads, certificates from user records. SublimePDF's API accepts a JSON payload paired with an HTML/CSS template and renders a pixel-perfect PDF, letting you generate thousands of documents programmatically without any manual formatting.
How to Automate PDF Generation
Manually creating PDFs for invoices, reports, or certificates doesn't scale. Automating PDF generation through an API lets your application produce documents on demand — triggered by user actions, scheduled jobs, or webhook events. SublimePDF's REST API integrates into any tech stack (Node.js, Python, Ruby, Go, PHP) and generates PDFs from HTML templates, Markdown, or raw URLs.