Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

HTML that is taller than one sheet normally creates additional PDF pages automatically. You usually do not append pages yourself. Let the document remain in normal flow, remove print-time height and overflow constraints, then use print CSS to define paper size, margins and only the page breaks you actually need. If content is clipped, inspect the generated PDF and fix fixed heights, hidden overflow, absolute positioning or screen-only sizing.

Why overflowing HTML should become more PDF pages

When a browser prints a document, its layout engine fragments the document into page-sized areas. Paragraphs, lists and other flow content continue onto the next page when they do not fit. A long article therefore needs no JavaScript routine that calculates page counts and no manual PDF-page insertion.

Clipping usually means the print layout is preventing fragmentation. Typical causes are height: 100vh, a fixed pixel height, overflow: hidden or overflow: auto, an absolutely positioned panel, or a desktop-width assumption that does not fit the selected paper. Correct those constraints in an @media print rule and verify the actual PDF rather than relying on the screen view.

Build a print stylesheet that can grow

Keep the printable content in normal document flow. Use print media rules to hide interface elements and undo screen restrictions, then define the paper with @page:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
@media print {
  .site-header,
  .toolbar,
  .site-footer,
  .no-print {
    display: none;
  }

  .print-content {
    height: auto;
    max-height: none;
    overflow: visible;
    width: auto;
  }

  .keep-together {
    break-inside: avoid;
  }

  .new-section {
    break-before: page;
  }
}

@page {
  size: A4 portrait;
  margin: 15mm;
}

@page sets the sheet size, orientation and margins. Browser support for individual paged-media features is not identical, so test with the browser and PDF pipeline your readers use. The print rule changes only the printed representation; the screen layout remains unchanged.

Control where content is allowed to split

Let ordinary paragraphs and sections flow

Do not add a break after every element. Automatic pagination is generally the least wasteful result: a paragraph can continue on the next page and a long list can fragment as needed. Forced breaks often create nearly empty pages.

Keep a small component together

Apply break-inside: avoid selectively to a compact card, short list, figure and caption, or a heading with a small following block:

.figure-card,
.callout,
.compact-list {
  break-inside: avoid;
}

This is a request to avoid splitting the box; it does not create a new page. If the element is taller than the available page area, the browser may still fragment it. The older page-break-inside property is a deprecated compatibility alias; prefer break-inside in new CSS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start a chapter or report section on a new sheet

Use a deliberate boundary only where the document design requires one:

.chapter {
  break-before: page;
}

.end-of-section {
  break-after: page;
}

break-before: page asks the renderer to start that element on a fresh page. It is appropriate for chapters, appendices or cover-to-content transitions, not for every card or paragraph.

Remove the constraints that cause “HTML to PDF is cut off”

  • Fixed height: Change a content wrapper from a fixed value to height: auto; also remove an inherited max-height.
  • Clipping overflow: Override overflow: hidden and scrolling containers with overflow: visible for print.
  • Absolute positioning: Return long content to normal flow. Absolutely positioned items can overlap or extend beyond the page instead of contributing their height.
  • Viewport sizing: Rules based on 100vh or a screen-width grid can be inappropriate on paper. Use print-specific width, height and grid rules.
  • Nested scroll areas: A table or panel with its own scrollbar may print only its visible region. Remove the scroll constraint or provide a print-specific layout.
  • Images and media: Constrain oversized images to the printable width and choose whether a figure should stay together. A very tall image may need to be allowed to split.

After each change, open print preview and then inspect the downloaded PDF. A preview that looks correct at one paper size can still clip when the user selects another.

Rank #2
Sale
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
  • Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
  • Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
  • Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
  • Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
  • Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.

Choose paper size, margins and browser print options

Setting What it controls Practical check
@page size Paper dimensions and portrait or landscape orientation Match the browser dialog’s paper selection
@page margin Printable area around the content Leave enough room for browser-generated headers and footers
Print headers and footers Browser-added URL, title, date or page numbers Disable them in the dialog when they are unwanted
Scale Dialog-level shrinking or expansion Use default scale first; excessive shrinking can hide layout defects
Background graphics Whether the dialog prints background colors and images Enable only when the design requires it

Chrome can add its own headers and footers alongside authored page margins when there is room. Disable those generated headers and footers in the print dialog if they interfere with the design. CSS content in printed margin boxes is version-sensitive; Chrome for Developers documented margin-box support arriving in Chrome 131 (article published October 30, 2024), so do not assume it works in every browser.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Save the page manually as a PDF

  1. Open the finished HTML page in the target browser.
  2. Open the browser’s print command (for example, Print in the browser menu).
  3. Choose Save to PDF or the equivalent PDF destination.
  4. Set paper size and orientation to match @page.
  5. Set margins deliberately, decide whether to print browser headers and footers, and check the preview for every page.
  6. Save the PDF, then inspect page boundaries, clipped edges, blank pages, images and tables in a PDF viewer.

If a section begins on a new page unexpectedly, search the print stylesheet for break-before, break-after and legacy page-break declarations. If the last lines of a panel disappear, search all ancestors for fixed heights and non-visible overflow.

Generate multiple-page PDFs with Puppeteer

Puppeteer’s Page.pdf() renders using the print CSS media type by default. That means your @media print rules and @page settings are used unless you explicitly emulate screen media. A minimal Node.js script is:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com/report', { waitUntil: 'networkidle0' });
await page.pdf({
  path: 'report.pdf',
  format: 'A4',
  printBackground: true,
  margin: { top: '15mm', right: '15mm', bottom: '15mm', left: '15mm' }
});
await browser.close();

Use page.emulateMediaType('screen') before page.pdf() only when you intentionally want screen styles instead of print styles. Puppeteer also adjusts colors for print by default; when exact colors matter, its documentation points to -webkit-print-color-adjust. These behaviors describe Puppeteer and should not be assumed for every HTML-to-PDF library.

Wait for content that is loaded after navigation

For client-rendered pages, wait for a meaningful selector, application-ready signal or required assets before calling pdf(). A network-idle event alone may not represent a page that continues fetching data. Conversely, an application that keeps a connection open may never reach a strict idle condition; choose a bounded, deterministic readiness check.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Compare the two rendering workflows

Workflow Best fit Important behavior
Browser print dialog One-off exports and user-controlled documents Reader chooses paper, scale, margins and generated headers/footers
Puppeteer Page.pdf() Repeatable server-side or CI generation Print media is the default; script controls waiting and output options
Automatic flow Long prose, lists and tables Content continues to later pages without manual breaks
Selective breaks Chapters, appendices and small groups that must stay together Use break-before or break-inside sparingly

Troubleshoot blank, clipped or badly split pages

Content is clipped at the bottom

Inspect the outermost content containers for height, max-height, overflow: hidden and scrollable overflow. Override them in print CSS, and check whether an absolutely positioned child is outside the flow.

A whole card moves to a later page or leaves a large gap

break-inside: avoid may be working as requested. Remove it from large components or apply it only to genuinely short groups. The browser cannot keep a box together when it does not fit in the remaining space.

Rank #3
Scrivar PDF Pro - Organize, Edit, Compress, Convert, Merge, eSign, OCR & 30+ tools | Lifetime License
  • EVERY PDF TOOL UNLOCKED - 30+ tools in one app: edit text and images, convert, merge, split, compress, sign, OCR, redact, watermark, batch process, and more. No feature gates, no upsells, nothing held back.
  • PAY ONCE, OWN FOREVER — A one-time purchase, not a subscription. Other apps runs $240/year — Scrivar is yours for life, with free updates included.
  • UNLIMITED eSIGN, BUILT IN — Send contracts and forms for signature and track every step. Recipients sign in their browser with no account or app needed. Replace DocuSign and save hundreds a year.
  • PC, MAC, AND WEB — Install on any Win 10/11 PC or macOS 11+ Mac (Intel or Apple Silicon), or work in your browser at scrivar.com. Same tools, same account, everywhere you work.
  • OCR + FULL OFFICE CONVERSION — Turn scanned documents into searchable, selectable text, and convert PDFs to and from Word, Excel, and PowerPoint with formatting kept intact.

There is an unexpected blank page

Look for a forced break on an element that already starts a page, an empty block carrying break-before, or a print-only height. Remove redundant breaks and recheck margins and generated headers.

Styles look like the screen rather than the print design

Confirm that the print stylesheet is loaded and that the automated pipeline has not called emulateMediaType('screen'). In a browser, use print preview rather than a normal screen inspection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Images or fonts are missing

Wait for the resources your page needs, use reachable URLs in the rendering environment and verify the final PDF. A successful navigation does not guarantee that a late image or web font has finished loading.

Headers, footers or margins collide

Turn off browser-generated headers and footers, increase @page margins, or reserve space for them. Check the final PDF at the exact paper size rather than judging only a responsive preview.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup:

For an API-generated capture, ScreenshotNeo returns a PDF from one GET request and can apply paper size, margins, landscape mode and page ranges. Its cleaning steps accept consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets before capture; bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the complete parameter reference in the ScreenshotNeo documentation. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for the free plan.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Final validation checklist

  • Print CSS removes fixed heights and clipping overflow.
  • @page matches the intended paper and margins.
  • Automatic flow is used for ordinary content.
  • break-inside: avoid is limited to small groups.
  • Forced page breaks are reserved for genuine section boundaries.
  • Browser-generated headers and footers are either disabled or accounted for.
  • The PDF is inspected at every page boundary and at the target paper size.
  • Automated generation waits for the content that must appear and uses the intended media type.

Frequently Asked Questions

Do I need JavaScript to add pages to an HTML PDF?

No. Browser print layout normally creates as many pages as the document needs. JavaScript is useful for automating generation, not for manually appending ordinary overflow pages.

Will break-inside: avoid prevent every split?

No. It requests that a box stay together when possible. A box taller than the available page can still be fragmented.

Can I use screen CSS for Puppeteer PDFs?

Yes. Call page.emulateMediaType(‘screen’) before page.pdf(), but do so only when screen styling is intentional; print media is Puppeteer’s default.

Quick Recap

Bestseller No. 1
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$99.99
SaleBestseller No. 2
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.; Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
$74.99

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.