October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober 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 Content Cut Off in html2pdf.js PDFs

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

When html2pdf.js cuts off content, first find where it disappears: in the rendered canvas, in the cloned export layout, at a page boundary, or only when the capture becomes very large. Each symptom points to a different fix. Check the canvas and export clone before changing page-break settings; then adjust the narrowest relevant option and verify the PDF at page boundaries in the browsers and document lengths you support.

Identify which stage is losing the content

html2pdf.js runs in a browser and uses html2canvas and jsPDF to turn a webpage or element into a PDF. Its documented workflow is .from() -> .toContainer() -> .toCanvas() -> .toImg() -> .toPdf() -> .save(). The stages matter: a page-break rule cannot restore content that was already missing from the canvas, and changing canvas scale will not correct a cloned layout that has reflowed.

Use this sequence to locate the failure:

  1. Inspect the canvas. If text or elements are already absent or clipped in the rendered canvas, investigate the source HTML/CSS and html2canvas rendering behavior.
  2. Inspect the export clone. If the live page looks right but the export does not, compare the source element with the cloned container, including computed dimensions, styles, and descendants.
  3. Inspect page boundaries. If the canvas contains the content but the PDF splits it awkwardly, tune page-break behavior for the affected sections.
  4. Test document size and scale. If longer documents or higher rendering scales produce blank or incomplete output, reduce the canvas dimensions or split the job into smaller exports.

This diagnosis separates four common symptoms: a break through content, layout reflow, renderer omission, and an oversized capture surface. Change one factor at a time so the result tells you which stage was responsible.

Check the export layout and cloned element

The html2pdf.js README documents that the library resizes the root element to fit a PDF page. That can cause internal content to reflow: text may wrap differently, elements may move, or a region that appeared on the live page may no longer be where expected in the export. Inspect the capture container while export is in progress, not only the original page.

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

Match the capture width to the intended page

Choose the export element’s width and CSS with the PDF page dimensions in mind. A container that is wider or narrower during export than the layout was designed for can change line wrapping and downstream element positions. There is no single CSS correction that works for every page; the right dimensions depend on the document’s layout and the page size you are targeting.

Compare the source and clone

Cloning nodes, including their CSS, is a documented issue area. If a descendant or style is missing, identify whether it disappears in the cloned container or later during canvas rendering. Check the clone’s computed styles and dimensions, and confirm that required styles are available when the clone is rendered. Treat a clone problem separately from a canvas problem: changing scale or page breaks will not restore a style that was never applied to the clone.

When debugging, reduce the page to the smallest element that still reproduces the changed wrapping or missing content. This makes it easier to see whether the export width, a particular style, or a cloned descendant is responsible.

Choose page-break rules that match the content

html2pdf.js offers page-break modes avoid-all, css, and legacy. The documented default is ['css', 'legacy']. It also supports before, after, and avoid selectors. CSS mode recognizes always, left, and right for breaks before or after elements, and avoid for breaks inside elements.

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

Use a targeted rule for a known section

If a particular section should start on a new page, select that section instead of changing the behavior of every element:

html2pdf().set({
  pagebreak: { mode: 'avoid-all', before: '#page2el' }
});

This follows the project’s documented configuration example. Replace #page2el with a selector that matches the section in your document. For content that should stay together, apply an appropriate CSS break rule or use the avoid selector option on meaningful blocks. The library also recognizes the legacy .html2pdf__page-break class.

Use avoid-all cautiously

avoid-all attempts to keep every element intact. That can help when small blocks are being split, but it is a broad rule: an element too tall to fit on one page may create unwanted whitespace or move farther than expected. Compare it with a narrower CSS rule or selector for the specific content that must remain together. A useful page-break configuration is the narrowest one that expresses the actual document structure, not necessarily the most comprehensive mode.

Remember that page slicing is pixel-based

The project README states that “html2pdf.js renders all content into an image, then places that image into a PDF.” As a result, text in the output is not selectable or searchable, and page slicing works on rendered pixels rather than semantic text lines. A page boundary can therefore fall through a line even when the HTML itself has well-formed paragraphs. Page-break controls and smaller DOM blocks can reduce awkward splits, but inspect the PDF visually; the documentation does not promise a universal setting that produces ideal breaks for every layout.

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

Reduce canvas size when long captures fail

The project documents a maximum HTML canvas width and height limitation. An oversized canvas can cause a large PDF to render completely blank. The documentation does not establish a single safe dimension or a universal page-count limit across browsers, so do not rely on one fixed threshold.

Rank #4
Sale
Funny Coding I Know HTML How To Meet Ladies T-Shirt
  • Funny saying for any front-end developer, web developer, computer programmer, computer systems engineer, mobile app developer, software developer, or code lover who likes to code, make funny programming jokes, and take memorable photos.
  • Wear it proudly at International Programmers' Day, school, coding classes, or coding communities! It also makes a funny present for a computer programming lover friend.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem

Lower the rendering scale

html2pdf.js accepts html2canvas options such as scale. Reducing scale reduces the canvas pixel dimensions and is a sensible diagnostic when failures correlate with a high scale or long content. It can also change output sharpness, so inspect text and graphics at the zoom level that matters to your users. No particular scale is guaranteed to be safe for every browser or document.

Export long material in sections

If one very long capture continues to exceed the available canvas size, divide the content into smaller sections and export them separately. This avoids relying on a single enormous canvas, but it requires you to check section boundaries and the resulting files or assembly process. Test the actual browser and document lengths you expect to support.

Verify the result instead of guessing

  1. Save a reproducible example. Keep only the smallest content and styles that still produce the failure.
  2. Inspect the intermediate output. Confirm whether the clone has the expected descendants and computed styles, then inspect the canvas for clipping or omissions.
  3. Apply one matching correction. Adjust layout dimensions for reflow, page-break controls for boundary splits, rendering inputs for canvas omissions, or scale/section size for oversized captures.
  4. Review every page boundary. Check the PDF at normal reading zoom and around each break. Look for clipped lines, unexpected blank areas, moved sections, and missing content.
  5. Retest representative cases. Verify the result across the target browsers and short and long examples. Keep a regression fixture for the layout that failed.

The html2pdf.js project asks bug reports to include reproducible code. A small example that shows the source element, export options, and failing output is more useful than a description that only says the PDF is cut off.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
I Know HTML How To Meet Ladies Funny Programming Language T-Shirt
  • Programming Language Lover Code Apparel. App or Web Design and Development Expert Funny Dress. Best Valentines Idea For Coding Lover. HTML Code or Meaning Costume
  • Funny I Know HTML - How To Meet Ladies Computer Programmer Quotes
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common causes and fixes

What you see Likely stage What to check
Text or an element is missing in the canvas HTML/CSS or canvas rendering Inspect the source and clone; investigate the relevant html2canvas rendering behavior before changing PDF page breaks.
Text wraps differently or elements move in the export Export layout Check the root width and styles as html2pdf.js resizes the root element to fit the PDF page.
A page boundary cuts through a line or block Page-break handling Use CSS break rules or targeted selectors on meaningful sections; compare with the default modes.
Large captures become blank or incomplete Canvas dimensions Reduce html2canvas scale or split content into smaller exports, then validate the pages.
A broad break rule creates large gaps or pushes content Page-break scope Replace avoid-all with targeted selectors or rules where possible, particularly for elements too tall for one page.

These are diagnostic branches, not guarantees: the project documentation does not establish one environment-independent fix for every CSS layout or browser.

Or skip the browser setup

If the goal is a clean screenshot of a webpage rather than a selectable-text, browser-generated document built from your DOM, ScreenshotNeo is a separate screenshot API and MCP server. A single GET request captures a URL; use it when a page image is what you need, not as a drop-in repair for html2pdf.js layout or semantic-text limitations. See the ScreenshotNeo documentation for request options.

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

ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses include X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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

Frequently Asked Questions

Can html2pdf.js produce searchable PDF text?

No. Its documented pipeline renders the content into an image and places that image in the PDF, so the resulting text is not selectable or searchable.

Does the html2pdf.js README give a universal maximum page count or canvas size?

No. It documents canvas width and height limits but does not specify a universal safe dimension or page-count threshold across browsers.

Does a user issue showing a particular scale prove that scale fixes cut-off text?

No. An issue opened on April 5, 2024 reports line breaks and shows a configuration with CSS page breaks, a section selector, and scale 4, but it has no maintainer-confirmed solution.

Quick Recap

Bestseller No. 2
SaleBestseller No. 4
Funny Coding I Know HTML How To Meet Ladies T-Shirt
Funny Coding I Know HTML How To Meet Ladies T-Shirt
Lightweight, Classic fit, Double-needle sleeve and bottom hem
$14.27
Bestseller No. 5
I Know HTML How To Meet Ladies Funny Programming Language T-Shirt
I Know HTML How To Meet Ladies Funny Programming Language T-Shirt
Funny I Know HTML - How To Meet Ladies Computer Programmer Quotes; Lightweight, Classic fit, Double-needle sleeve and bottom hem
$19.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.

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.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.