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

The simplest way to export a contenteditable area as a PDF is to style the document for print and call window.print() from an export button. The browser opens its print dialog; the user can choose a PDF destination if their browser and system offer one. This keeps text in the browser’s print layout rather than turning the page into a single canvas image.

If you need an element-targeted, direct-download flow, a browser library such as html2pdf.js is an option, but its canvas-based output can make text non-selectable and non-searchable. For server-side PDF generation, consider a managed HTML-to-PDF service and review how it handles content and linked resources before sending user data.

Choose an export method

Approach Best fit Trade-offs to check
window.print() with print CSS A user-triggered export where a print dialog and the browser’s PDF destination are acceptable The user controls the final dialog and destination. Tune print styles and pagination, and check the browsers your users rely on.
html2pdf.js or another canvas-based library Exporting a particular element in the browser and initiating a download Text may not be selectable or searchable; files can be large; supported CSS and cross-origin images or iframes can limit fidelity.
Managed HTML-to-PDF API Server-side generation or a centralized document workflow Check the vendor’s rendering behavior, resource loading, latency, service terms, and handling of user HTML.

For a typical editor’s “Export as PDF” button, begin with print CSS. Use a library or service only when its specific workflow solves a requirement that the print dialog does not.

Prepare the editable content

Give the document a dedicated export region instead of trying to print the entire editor interface. Keep toolbars, buttons, resize handles, selection decorations, and other controls outside that region where practical. Before starting an export, make sure the element’s DOM contains the current editor value; the right synchronization step depends on your editor framework.

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

Here is a minimal example. The editable region contains the document, while the toolbar is hidden in print output:

<button id="export-pdf" type="button">Print or save as PDF</button>
<div id="editor" contenteditable="true">
  <h1>Project notes</h1>
  <p>Edit this document, then export it.</p>
</div>

<style>
  #editor {
    max-width: 48rem;
    margin: 2rem auto;
    padding: 2rem;
    font: 16px/1.5 Arial, sans-serif;
  }

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

  @media print {
    #export-pdf {
      display: none !important;
    }

    #editor {
      max-width: none;
      margin: 0;
      padding: 0;
      color: #000;
      background: #fff;
      font-size: 11pt;
    }

    #editor * {
      box-shadow: none !important;
    }
  }
</style>

<script>
  document.getElementById('export-pdf').addEventListener('click', () => {
    window.print();
  });
</script>

The example calls print directly from the button’s click handler. That makes the browser’s print dialog the visible next step; your page does not silently choose a destination or save location.

Style and paginate the printed document

Hide editor-only interface

Use @media print to remove controls and adjust the document for paper or PDF. Set print-friendly widths, typography, spacing, and colors. Consider whether backgrounds should appear and whether the document remains legible when printed without them. Avoid relying on visual cues such as selected text or editor-only outlines to convey meaning.

Keep the print rules scoped to the export region where possible. If the page has other content that should not appear, hide it explicitly for print rather than assuming the browser will infer which element is the document.

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

Set page layout

Use @page for page dimensions, orientation, and margins where the target browser supports the controls you need. The example uses A4 portrait, but the appropriate page size depends on your audience and document. Browser support and user print settings affect the final result; preview in the browsers and conditions you support rather than promising identical output everywhere. See MDN’s printing guide and MDN’s paged media guide.

Check page breaks and long content

Review the print preview with realistic documents, not only a short sample. Check headings near page boundaries, long tables, lists, images, and content that spans multiple pages. Adjust spacing and print layout if content is cramped, clipped, or broken across pages in an unhelpful place. Different content lengths and browser layouts can expose problems that do not appear in a one-page test.

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⁴

Trigger the browser’s PDF workflow

  1. Update or synchronize the editable region so its DOM reflects the content the user intends to export.
  2. Run window.print() from the user’s export action.
  3. Let the user review the browser’s print preview and select a PDF destination when available.
  4. Test the resulting file for page layout, text selection, fonts, and images in your supported browsers.

Label the control clearly—for example, “Print or save as PDF”—because the browser, not the webpage, presents the dialog and controls the final destination.

Use html2pdf.js when you need an element-targeted download

html2pdf.js documents a browser-side workflow that uses html2canvas and jsPDF. It can be useful when you need to target a particular DOM node and offer a direct save flow instead of asking the user to complete the browser print dialog. Follow the project’s documentation for installation and API usage; this article does not pin a package version.

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

Do not treat this as an exact browser print conversion. The html2canvas project explains: “The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it is not actually a screenshot, but builds the screenshot based on the information available on the page.” Its output depends on the DOM information and CSS it supports. The html2pdf.js documentation also cautions that text may not be selectable or searchable and that output files can be large.

Before choosing this route, generate PDFs from realistic editor content and check whether users can search and select text, whether page breaks are acceptable, and whether fonts and images render as expected. Canvas rendering can also be affected by browser origin restrictions for external images and iframes; see the html2canvas documentation and its FAQ.

Use a managed service for server-side conversion

If conversion must happen on your server or as part of a centralized workflow, a hosted service may fit better than browser-side rendering. For example, HTML2PDF.app documents an authenticated API that accepts raw HTML or a public page URL and returns PDF bytes. Adobe PDF Services also documents HTML-to-PDF conversion.

Before sending editor content to a third party, determine whether the service can access any linked resources it needs and assess the service’s data handling, terms, rendering behavior, and latency against your requirements. These services are not interchangeable guarantees of identical browser rendering.

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.

Or skip the browser setup

If you need a screenshot or PDF from a URL rather than a PDF generated from the user’s editable DOM, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a clean screenshot or PDF. Its documented API details are at ScreenshotNeo’s documentation.

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

This example saves the response as a WebP screenshot. ScreenshotNeo also supports PDF output; consult the API documentation for the PDF request format. It captures a URL, so it is not a substitute for exporting unsaved content that exists only in an editor’s DOM.

  • Cookie and consent banners are accepted like a visitor, and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before capture; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Responses include X-Page-Verdict and X-Billed headers.
  • 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 with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan.

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

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

Troubleshoot common export problems

The PDF includes toolbars or buttons

Add the unwanted controls to print-specific rules under @media print, using a selector that targets the editor UI rather than the document. Reopen print preview after changing the CSS; screen styles alone do not determine print output.

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.

The saved PDF is out of date

Check that the current editor value has been committed to the DOM before calling window.print() or passing the export node to a library. If your framework stores edits separately from the rendered element, synchronize or render the latest value before capture.

Text is hard to select or search

Check whether the PDF was produced through a canvas-based library. Such output may behave like an image rather than ordinary text. If selectable, searchable text matters, start with the browser’s print pipeline and verify the actual generated file.

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

An external image is missing

For canvas-based rendering, check whether the image or iframe is cross-origin and whether browser security rules allow it to be drawn into a canvas. The html2canvas FAQ documents these restrictions. Test with the actual resource host and configuration used in production.

Content is clipped or breaks awkwardly

Inspect the print preview at the target page size and margins. Revisit fixed widths, large padding, page-break-sensitive content, tables, and long images. Test multiple document lengths; an adjustment that works for one page may not work for a longer document.

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

Print preview differs across browsers

Check the supported browsers, their print previews, and the users’ print settings. Print CSS and page-layout support do not guarantee identical rendering across browser versions or settings. Where consistent output is essential, evaluate a managed conversion workflow against representative documents.

FAQ

Does contenteditable itself provide a PDF export method?

No. contenteditable makes an element editable; the export flow comes from the browser’s print pipeline, a library, or a conversion service.

Should I choose A4 or Letter?

Choose the page size your users need, then set and test it with @page where supported. The right choice depends on the document’s intended use and audience.

Can I promise the PDF will look identical on every device?

No. Browser rendering, supported print controls, fonts, and user settings can change the result. Validate the browsers and conditions that matter to your application.

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

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.