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

If jsPDF’s deprecated addHTML() call captures document.body instead of your intended element, first verify which DOM node your code passes to the renderer. Then test the capture independently from PDF creation. For new code, migrate to jsPDF’s html() method using the API documented for your installed release; do not assume a selector change alone explains the symptom.

Why addHTML() may capture the wrong content

There is no single confirmed cause for every body-only capture. The symptom can arise from the element selection, how the legacy method is invoked, a mismatch between library versions and their completion behavior, or a problem in browser rendering. Without the calling code, installed package versions, and runtime, it is not possible to identify which applies to a particular page.

The migration direction is clearer: jsPDF maintainers marked addHTML and fromHTML deprecated and introduced html() as the maintained HTML-rendering path. Use the documentation for the exact jsPDF release in your project to verify the supported arguments, options, and completion behavior. Do not treat old issue reports as proof of a current-version bug.

Check that you selected the intended element

Before rendering, query a unique container and fail clearly if it is missing. This browser-console diagnostic shows the node immediately before you pass it to a renderer:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images
const target = document.querySelector('#pdf-content');
if (!target) throw new Error('PDF target not found');
console.log(target, target.tagName, target.id);

Inspect the logged node in DevTools. Confirm it is the element that contains the material to export—not document.body, a wrapper that includes unrelated content, or an empty container. If the ID appears more than once, fix the duplicate markup; querySelector returns the first match.

Then pass that verified DOM element to the rendering method. Both html2canvas and html2pdf.js document element-based workflows. For jsPDF specifically, use the html() API as documented for your installed release. Its precise signature and completion mechanism are version-sensitive, so a universal copy-and-paste call cannot be established from the available versioned API information.

Test browser capture before building the PDF

Separate the question “Did the browser render the right element?” from “Did the PDF receive the right output?” html2canvas accepts a DOM element and returns a Promise that resolves to a canvas. Run this in a browser after selecting your target:

Rank #2
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
const target = document.querySelector('#pdf-content');
if (!target) throw new Error('PDF target not found');

html2canvas(target).then((canvas) => {
  document.body.appendChild(canvas);
  console.log('Captured canvas:', canvas.width, canvas.height);
}).catch((error) => {
  console.error('Canvas capture failed:', error);
});

This test deliberately stops before creating a PDF. If the canvas shows the wrong content, investigate the selected element, its rendered state, and browser resource restrictions. If the canvas is correct but the PDF is wrong, focus next on the jsPDF rendering call, its options, and how the result is placed or completed.

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

Appending the canvas is only a diagnostic; remove that line after checking the result. A large canvas may extend beyond the visible viewport, so use the logged dimensions and inspect the appended output rather than assuming a small on-screen portion represents the whole capture.

Migrate away from addHTML()

Use the jsPDF HTML renderer for a jsPDF-based workflow

  1. Check the installed jsPDF version and consult its matching API documentation for html(), including its arguments and completion behavior.
  2. Select and validate the intended element, as shown above; pass that node rather than document.body.
  3. Render with the documented html() call and wait for completion using the mechanism specified for that release.
  4. Inspect the resulting PDF in the browsers and environments you support, including pages with images, fonts, and content that spans multiple pages.

Do not mechanically replace the name addHTML with html while leaving an old callback or dependency assumption in place. The maintainer’s migration note identifies html() as the maintained route, but the correct call details must match the installed release.

Rank #3
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Consider html2pdf.js when its trade-offs fit

html2pdf.js documents passing a selected element to html2pdf(element). Its README also documents page-break controls. It is browser-only, and its output is image-based: text in the resulting PDF is not selectable or searchable, and the file can be larger than text-based output. It also documents cloned-node issues and canvas dimension limits.

With an npm or bundled package, html2pdf.js includes its dependencies. If using separate, unbundled scripts, load jsPDF first, html2canvas second, and html2pdf.js last; order matters. Follow the project’s README for the rest of the setup and save behavior rather than mixing script versions or copying a call written for another release.

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

Inspect versions, resources, and rendering constraints

Verify the dependency combination

Record the exact jsPDF, html2canvas, and html2pdf.js versions actually loaded by the page. A historical jsPDF issue reported a callback problem with html2canvas 1.0.0-alpha.10; its discussion pointed to html2canvas’s move to a Promise API. That report concerns old versions and is not a diagnosis for a modern application, but it illustrates why callback and Promise expectations must match the dependencies in use.

Rank #4
Sale
Epson Workforce ES-400 II High-Speed Color Duplex Desktop Document Scanner
  • FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
  • INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
  • SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
  • EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
  • SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning

Check images and other cross-origin resources

html2canvas runs in the browser and does not bypass browser cross-origin rules. Images or other resources served from another origin may be blocked or taint the canvas, depending on how they are served and configured. Test with those resources removed, then add them back one at a time. A failure limited to a third-party image is different from selecting the wrong DOM node.

Check page size and cloning behavior

Large or very tall content can run into browser canvas dimension limits. html2pdf.js also documents issues involving its cloned rendering node. If the capture is cropped or incomplete, compare the target’s dimensions with the canvas dimensions, reduce the test content, and check the html2pdf.js limitations for the browser you support. Do not infer that a selector is wrong solely because a large page is truncated.

Troubleshooting by symptom

Symptom What to check Next step
The output contains the whole page Log the selected element immediately before rendering. Check whether the code passes document.body or a broad wrapper. Use a unique selector, verify its result, then pass that node to the documented renderer.
The target query returns null The selector may be wrong, or the code may run before the target is present. Correct the selector or run the export after the page has created the target; retain the explicit missing-target error.
The canvas already contains the wrong content The problem occurs before PDF construction. Inspect node selection and browser-rendered content, then check resource restrictions and capture timing.
The canvas is right but the PDF is wrong The capture succeeded; PDF rendering or placement remains to be checked. Verify the jsPDF release-specific html() invocation, options, and completion handling.
The completion callback does not run Legacy callback assumptions may not match the installed dependency’s completion mechanism. Check each exact version’s API documentation and use the documented Promise or callback behavior; do not use the old issue report as a current compatibility guarantee.
Images are missing or the canvas fails Cross-origin restrictions or unavailable resources may affect browser capture. Test without the affected resources, then verify their origin and browser access configuration.
Long content is cut off or malformed Canvas limits or html2pdf.js node-cloning behavior may be involved. Test a smaller page, inspect dimensions, and review the renderer’s documented limits and page-break options.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose the PDF path that matches the output you need

Before switching libraries, decide whether the exported document must contain selectable, searchable text, how precisely it must preserve CSS, whether page breaks need control, and whether rendering must work outside a browser. Compare the exact supported package versions and whether the input is a DOM node or an HTML string. If image-based PDF output is acceptable, html2pdf.js offers a browser workflow and documented page-break controls. If it is not, test jsPDF’s current HTML path against the document you actually need; do not assume raster rendering and text-based PDF output have identical properties.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
ScanSnap iX1300 Wireless or USB Double-Sided Color Document Scanner, Black
  • FITS SMALL SPACES AND STAYS OUT OF THE WAY. Innovative space-saving design to free up desk space, even when it's being used
  • SCAN DOCUMENTS, PHOTOS, CARDS, AND MORE. Handles most document types, including thick items and plastic cards. Exclusive QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
  • GREAT IMAGES EVERY TIME, NO EXPERIENCE REQUIRED. A single touch starts fast, up to 30ppm duplex scanning with automatic de-skew, color optimization, and blank page removal for outstanding results without driver setup
  • SCAN WHERE YOU WANT, WHEN YOU WANT. Connect with USB or Wi-Fi. Send to Mac, PC, mobile devices, and cloud services. Scan to Chromebook using the mobile app. Can be used without a computer
  • PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. ScanSnap Home all-in-one software brings together all your favorite functions. Easily manage, edit, and use scanned data from documents, receipts, business cards, photos, and more

Or skip the browser setup

If you need a clean screenshot of a web page rather than a fully selectable PDF document, ScreenshotNeo offers a one-request capture API. It can also return a PDF, but a screenshot/PDF capture service is not a drop-in replacement for generating a text-oriented PDF from your application’s DOM.

For example, this cURL request saves a WebP capture of the target URL; see the ScreenshotNeo API documentation for request options and PDF output:

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

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Learn more at ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.

Frequently Asked Questions

Does switching from addHTML() to html() guarantee the correct element will be captured?

No. Verify the selected DOM node and test capture separately; changing the rendering method does not correct a selector that points to the wrong element.

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

Can html2pdf.js produce selectable PDF text?

Its documented output is image-based, so the text is not selectable or searchable.

Quick Recap

Bestseller No. 1
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.