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.

Give the content you want to export its own root element, scope PDF-specific CSS beneath that root, and pass the element—not the whole document—to html2pdf(). This keeps unrelated content out of the capture and avoids editing page-wide styles. It does not remove existing global or inherited styles that also affect the export subtree, so inspect the generated PDF in the browser and version you ship.

Use a dedicated export element and scoped CSS

html2pdf.js renders a chosen DOM element through html2canvas and jsPDF. Put the PDF content in a dedicated element with a distinctive class or ID, then write the export rules so they match only that element and its descendants. This is CSS scoping, not a built-in html2pdf stylesheet-isolation option.

HTML

<div id="pdf-export" class="pdf-export">
  <h1 class="title">Quarterly report</h1>
  <p>This content is intended for the PDF.</p>
</div>

CSS

/* These rules affect the export subtree, not the whole page. */
.pdf-export {
  font-family: Arial, sans-serif;
  color: #222;
  background: #fff;
  padding: 24px;
}

.pdf-export .title {
  font-size: 24px;
  margin: 0 0 12px;
}

Avoid changing shared selectors such as body, h1, or application-wide classes just to prepare a PDF. If your existing stylesheet already contains a selector that matches the export element, however, that rule still participates in the CSS cascade. A new scoped rule only adds or overrides declarations where its selector applies; it does not erase other matching rules or inherited values.

JavaScript

const element = document.getElementById('pdf-export');

if (!element) {
  throw new Error('PDF export element #pdf-export was not found');
}

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

The project documents using a specific element as the source. Selecting the export root this way captures that element and its content rather than asking html2pdf.js to capture the entire document. Check the official html2pdf.js project documentation for the current installation and API details; its versioned 0.10.1 README also documents the element-source workflow and page-break behavior.

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

Keep the page stylesheet from leaking into the export

There is no universal switch in the cited html2pdf.js documentation that gives a captured element an isolated stylesheet. CSS isolation is an architecture choice. Start with a uniquely named export root and scoped selectors, then check computed styles and the resulting PDF for collisions. Broad rules, inherited typography, resets, and component styles can still influence the subtree.

When a scoped subtree is enough

  • Use it when the existing page styles do not conflict significantly with the document design.
  • Give the root a class reserved for export, such as .pdf-export, and prefix export-specific descendant selectors with it.
  • Use selectors specific enough to override unintended application rules, but avoid escalating into brittle selector chains or widespread !important declarations.
  • Keep the export markup limited to content that belongs in the document; navigation, buttons, and other page chrome should normally stay outside the source element.

When to render a separate export document or component

If global CSS causes repeated conflicts, render a dedicated export-only document or component with its own stylesheet and assets, then capture that root. This provides stronger style separation but requires extra setup: the content, fonts, images, and other assets still need to load correctly, and the separate version must stay faithful to the information shown on the page. The official sources do not prescribe one architecture for every application; choose based on the degree of cascade conflict and the fidelity you need.

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⁴

Do not rely on print-only CSS for html2pdf.js

Browser print styles and html2pdf.js capture are different workflows. MDN documents print-targeted styles such as <link href="print.css" rel="stylesheet" media="print"> and @media print for printing, including browser print-to-PDF. html2pdf.js instead documents a client-side workflow through html2canvas and jsPDF. Therefore, do not assume a rule inside @media print, or a stylesheet marked media="print", will be applied during an ordinary html2pdf.js capture.

If your app or a particular library integration changes media emulation, verify that behavior in the actual runtime rather than treating print CSS as a reliable export stylesheet. For html2pdf.js, put needed PDF declarations in rules that apply to the captured element in the rendering context you use. See MDN’s printing guidance for browser print styles and the html2pdf.js documentation for its separate capture workflow.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Handle page breaks separately from CSS scoping

Scoping answers which styles affect the export subtree; pagination answers where content falls across PDF pages. One does not solve the other. html2pdf.js documents page-break configuration, including CSS break properties and the legacy html2pdf__page-break class. Use its documented options for your installed version and test the resulting pages: break controls help position content, but they do not guarantee that every layout will reproduce perfectly.

Pay particular attention to long elements, headings near page boundaries, tables, and content whose dimensions change after fonts or images load. The project identifies a limitation involving cloning nodes and CSS before passing content to html2canvas. That makes verification important when inherited styles, external fonts, pseudo-elements, or complex CSS affect the layout. A successful call to .save() is not proof that the PDF looks as intended.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate the PDF in the runtime you will ship

  1. Confirm the source. Check that your selector returns the intended export root and that unrelated page content is outside it.
  2. Inspect the cascade. In browser developer tools, review computed styles on the root and representative descendants. Look for inherited fonts, colors, spacing, widths, and application selectors that also match.
  3. Wait for content. Generate only after the data and required images or fonts are ready. If content is populated asynchronously, capture too early and the PDF may reflect an incomplete DOM.
  4. Review the actual PDF. Check typography, image rendering, clipping, page count, margins, and page breaks in the intended browser and the html2pdf.js version used in production.
  5. Retest after changes. Changes to shared CSS, component markup, fonts, or the html2pdf.js version can affect the cloned content and its rendering.

Troubleshooting common style and output problems

Symptom Likely cause What to do
The PDF has the page’s header or unrelated sections. The whole document, or an overly broad container, is the source. Call .from(element) with the dedicated export root and keep page chrome outside it.
The PDF still looks like the website. Existing application selectors or inherited styles also apply inside the export root. Inspect computed styles, namespace export rules, and override only the conflicting declarations. If the cascade remains difficult to control, render a separate export component or document.
Print CSS changes do not appear. The capture is using html2pdf.js’s html2canvas/jsPDF workflow, not the browser print workflow. Move required declarations into rules that apply to the capture, or verify media emulation in your specific integration.
Fonts, pseudo-elements, or complex layouts differ. Cloning and CSS handling before html2canvas can affect rendering; assets may also not be ready when capture starts. Test the generated PDF in the exact browser and library version, ensure fonts and assets are loaded, and simplify or isolate problematic styling where necessary.
Content splits awkwardly between pages. Page-break behavior is independent of style scoping, and a break rule may not fit the content geometry. Use the documented page-break options or CSS break properties for your version; adjust the layout and review each affected page.

Or skip the browser setup

If your goal is a screenshot or PDF of a publicly accessible web page rather than a customized export of your app’s DOM, ScreenshotNeo offers a one-request API. It does not replace the scoped-DOM method above when you need to export a particular local element with your own PDF stylesheet. For a URL-based capture, use this cURL example; 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 as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or 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 provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other 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 1,000 free screenshots a month with no card.

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

Choosing the right isolation level

For a straightforward report whose desired content already exists on the page, a scoped export root is usually the least disruptive starting point. It lets the capture target and PDF rules be explicit without rewriting shared page styles. If that subtree continues to inherit unwanted rules or your document design must be independent of the app, a separate export rendering path offers stronger separation at the cost of maintaining and loading another presentation. In either case, treat the generated PDF as the real test: stylesheet scope is not a guarantee of rendering fidelity.

Frequently Asked Questions

Does html2pdf.js automatically use my print stylesheet?

Do not assume it does. Its documented rendering path uses html2canvas and jsPDF, unlike browser printing; verify media behavior in your specific runtime if an integration may emulate print media.

Does passing an element to `.from()` isolate its CSS?

No. It limits the capture source to that element, but matching global rules and inherited values can still affect the subtree.

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.

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