October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
html2canvas

How to Fix Blank Pages in html2pdf.js

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

A blank PDF from html2pdf.js can mean the browser created a blank canvas, the capture exceeded a browser canvas limit, page-break rules displaced content, or images and styles failed during rendering. Find the failing stage before changing PDF settings: html2pdf.js turns the source into a container, canvas, image, and then PDF. The canvas is the key checkpoint. This guide walks through that diagnosis and the fixes that fit each symptom.

First, identify what is actually blank

These symptoms point to different causes, so note exactly what the output looks like before changing options:

  • Every page is blank: the render may have produced an empty canvas, or the capture may have exceeded browser canvas dimensions.
  • Only the first page is blank: investigate page-break rules, especially if you use avoid-all.
  • Images are missing but text appears: check image loading and cross-origin access.
  • Content is cut off or disappears partway through: suspect canvas dimensions, page-break behavior, or a rendering/cloning issue.

Also record the installed html2pdf.js and html2canvas versions, browser, operating system, target element, CSS, and options. Behavior can vary by browser and platform; a report involving one version or setup is not proof of a universal bug.

Trace the pipeline before changing PDF options

The documented html2pdf.js workflow proceeds from the source element to a cloned container, canvas, image, PDF, and saved file. If the canvas is already blank or incomplete, PDF margins and page size are downstream of the problem. Test the intermediate render first.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Epson EcoTank ET-2800 Wireless Color All-in-One Supertank Printer - Black
  • INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
  • COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
  • ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
  • HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs
  1. Reproduce minimally. Keep the same target element, relevant CSS, options, library versions, and browser. Remove unrelated page content until the problem remains reproducible.
  2. Inspect the canvas stage. Use the html2pdf.js worker stages or a direct html2canvas test to determine whether the captured pixels are already blank or clipped. The html2pdf.js project recommends testing canvas creation when the render is wrong.
  3. Compare the canvas with the PDF. If the canvas is correct but the PDF is not, investigate PDF assembly and pagination. If the canvas is faulty, focus on dimensions, content, and rendering instead.
  4. Change one variable at a time. Start with page-break rules, margins, image handling, or scale as indicated by the symptom; save each intermediate result so you can tell which change mattered.

For a useful reproduction, include the smallest HTML/CSS example, the exact options, the browser and platform, package versions, and whether the intermediate canvas is correct. A screenshot of the page alone cannot establish whether the failure occurred before or during PDF assembly.

Check for a canvas that is too large

Very tall or wide captures can exceed browser canvas limits. The html2pdf.js documentation warns that large PDFs can render completely blank when HTML canvas maximum dimensions are exceeded. The html2canvas FAQ says exceeding a browser limit can produce an empty or partly rendered canvas, sometimes without an error. Limits depend on browser and platform.

As a diagnostic, set the html2canvas viewport dimensions to the target element’s scroll dimensions:

const element = document.querySelector('#report');

const options = {
  html2canvas: {
    windowWidth: element.scrollWidth,
    windowHeight: element.scrollHeight
  }
};

html2pdf().set(options).from(element).save();

This is something to test, not a way to bypass a browser’s maximum canvas size. If the target remains too large, try reducing scale or capturing a smaller content area. A lower scale reduces the pixel dimensions, though the result may look less sharp. Do not assume one scale value is safe for every browser or document.

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

The html2canvas FAQ’s rough guidance for current evergreen browsers is approximately 32,767 pixels for maximum dimension in Chrome/Chromium and Firefox, and desktop Safari is described as similar to Chrome. Its approximate maximum canvas areas differ: about 268 megapixels for Chrome/Chromium and 472 megapixels for Firefox. These are project-published estimates, not guaranteed safe targets; iOS Safari limits are lower and depend on device RAM. Leave headroom rather than designing a capture to land exactly on a cited ceiling.

Rank #2
Sale
Epson EcoTank Photo ET-8550 Wireless Wide-Format All-in-One Tank Printer
  • CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
  • INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
  • PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
  • ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴

If a long report routinely approaches those limits, split it into smaller sections or reconsider the rendering approach. The documented html2pdf.js renderer turns the content into an image in the PDF, so the canvas-size constraint is fundamental to that path.

Investigate page breaks when only a page is blank

html2pdf.js supports page-break modes css, legacy, and avoid-all, plus targeted before, after, and avoid selectors. The documented defaults are CSS and legacy break handling. A broad avoid rule can affect pagination in ways that depend on the DOM and element sizes.

  1. Temporarily remove avoid-all and capture again.
  2. If the blank page disappears, add page-break handling back incrementally rather than applying avoid behavior to every element.
  3. Use CSS break rules or targeted selectors for the elements that truly need to stay together.
  4. Test margins separately from break rules if content is clipped at a page boundary.

A GitHub issue opened December 29, 2023 describes a blank first page with avoid-all; that reporter said removing span from the avoid selector fixed their case. This is one report, not a general fix. Another issue opened July 12, 2024 reports text clipped in the middle with html2pdf.js 0.9.2, avoid-all, and a margin setting; its author said removing the margin resolved that example. Treat both as leads for controlled tests, not proof that spans or margins are inherently incompatible.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Check images, CSS, fonts, and cloned markup

html2canvas renders DOM content into a canvas; it does not simply take a native browser screenshot, and it does not render every CSS property perfectly. html2pdf.js also documents known issues in its DOM-cloning process. If dimensions are reasonable but the canvas is wrong, reduce the example and check whether the missing content relies on unsupported styling, cloned-DOM styles, fonts, or resources that have not finished loading.

Cross-origin images

By default, html2canvas does not include cross-origin images that would taint the canvas when allowTaint is false. To try loading them with useCORS: true, the image server must send an appropriate Access-Control-Allow-Origin response header. The option does not grant access to an image server that does not permit cross-origin use. A same-origin proxy is another documented route where appropriate.

Rank #3
HP Smart Tank 5000 Wireless All-in-One Ink Tank Printer, Scanner, Copier with 2 Years of Ink Included, Best-for-Home, Cartridge-Free, Refillable and AI-Enabled. (5D1B6A)
  • SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
  • INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
  • KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
  • PREMIUM SUPPORT - Strong technical expertise to solve issues faster
  • THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
html2pdf().set({
  html2canvas: {
    useCORS: true
  }
}).from(document.querySelector('#report')).save();

Check the image URL directly, the browser network panel for failed requests, and the image server’s response headers. If the asset is blocked or not loaded, changing page size will not restore it.

CSS and fonts

When the canvas omits or misplaces content despite safe dimensions, remove complex CSS from the minimal reproduction and add it back piece by piece. Check whether fonts and images have loaded before capture, and whether styles applied in the live page survive html2pdf.js’s cloned markup. A direct html2canvas test can distinguish a renderer limitation from later PDF assembly.

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

Know what html2pdf.js output can and cannot do

html2pdf.js documents an image-based PDF path: content is rendered into an image and placed into the PDF. As a result, the resulting PDF text is not selectable or searchable, and files can be large. The project describes this as unavoidable in its documented renderer. If searchable text, substantially larger documents, or a different layout-fidelity trade-off is required, assess another PDF workflow against those requirements and its browser or server prerequisites; there is no single alternative established here as best for every project.

Common blank-page and clipping failures

Symptom Likely area to investigate Next test
Entire PDF blank Blank canvas or canvas dimension limit Inspect the canvas stage; reduce scale or target area and compare.
Blank first page with later content Page-break options, especially broad avoid-all Remove that mode, then add targeted breaks back gradually.
Content clipped partway through Canvas dimensions, break rules, or rendering/cloning Compare intermediate canvas; test dimensions, margins, and break settings independently.
Text present, external images absent Image loading or cross-origin restrictions Check network requests and CORS headers; test useCORS or a suitable proxy.
Canvas is correct, PDF is wrong PDF assembly or pagination Keep the canvas fixed and isolate PDF and page-break options.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and cost considerations

A large image-based capture consumes browser memory and can take longer to render; the canvas limits above make document size a reliability concern as well as a performance concern. Reduce the captured area, scale, or number of simultaneous captures when diagnosing resource pressure. Wait for required resources before capture, but do not assume that waiting can fix unsupported CSS or a canvas over its platform limit.

For a repeatable workflow, pin and record dependency versions, test in the browsers and devices your users actually run, and keep a small reproduction for regression checks when changing page-break or rendering options. The README’s console example links CDN 0.10.1, but that does not establish it as the latest release. The clipping report cited above is specifically about 0.9.2; neither version-specific observation should be generalized to all releases.

Rank #4
NDYIN Portable Printers Wireless for Travel, N80 Bluetooth Thermal Printer
  • Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
  • No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
  • Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
  • Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
  • The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art

Or skip the browser setup

If you need a clean screenshot or PDF of a webpage rather than a PDF generated from your own DOM, ScreenshotNeo offers a website screenshot API and MCP server. It is a separate capture route, not a fix for a broken html2pdf.js canvas. Its API can return PNG, JPEG, WebP, or PDF in one GET request.

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

Example cURL request (replace the target URL and API key):

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

See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie/consent banners before capture and removes 60+ known consent platforms, newsletter popups, and chat widgets; these steps can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to AI agents and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

FAQ

Does a blank PDF prove html2pdf.js itself is broken?

No. The failure may be in canvas rendering, page-break handling, content loading, or PDF assembly. Inspecting the intermediate canvas helps locate it.

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

Can I make text in an html2pdf.js PDF searchable?

Not with its documented image-based renderer; the project says the resulting text is not selectable or searchable.

Will windowWidth and windowHeight fix every truncated capture?

No. They are diagnostic dimensions to try; they do not raise browser canvas limits or guarantee that an oversized capture will fit.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.