DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober 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 Scan×
Skip to content
HTML to PDF

How to Export Plotly Graphs and HTML Content to PDF

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

Use Plotly’s static image exporter for a figure, and a real browser for a complete HTML page. In Python, install Kaleido 1.0.0 or newer, make Chrome or Chromium available, then call fig.write_image("figure.pdf"). For a dashboard or any full HTML document, load the page with Playwright and call page.pdf(), configuring print CSS, paper size, margins and page breaks. A PDF is static; keep an HTML export when readers need hover, zoom or legend interactions.

Choose the exporter that matches your input

What you have Use Rendering engine Result
A Python Plotly figure object fig.write_image("figure.pdf") or plotly.io.write_image Kaleido with Chrome/Chromium A static PDF of the figure
A complete HTML page, report or dashboard Playwright page.pdf() Chromium A paginated PDF following print CSS
An interactive figure for browser readers fig.write_html("figure.html") The reader’s browser HTML retaining hover, pan, zoom and legend controls

Do not use write_html as a PDF converter. It creates an interactive, browser-openable file; it does not produce a fixed document.

Export a Plotly figure to PDF in Python

1. Install Kaleido and a browser

Current Plotly documentation requires Kaleido 1.0.0 or newer. Kaleido version 1 expects Chrome or Chromium to be installed separately, rather than bundled with Kaleido.

python -m pip install --upgrade plotly kaleido

If Chrome is not already available, use Plotly’s documented helper:

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.
#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
plotly_get_chrome

In Python, the equivalent helper is plotly.io.get_chrome(). In locked-down CI images, install Chromium in the image and make sure the process can execute it before running the export.

2. Create and write the PDF

import plotly.express as px

fig = px.bar(
    px.data.gapminder().query("country == 'Canada'"),
    x="year",
    y="pop",
    title="Canada population"
)
fig.write_image("figure.pdf")

The filename extension selects the format. PDF is one of Plotly’s supported static formats, alongside PNG, JPEG, WebP and SVG. To use the functional API instead of the figure method:

import plotly.io as pio

pio.write_image(fig, "figure.pdf")

For a reproducible build, write to an explicit output directory, check that the resulting file exists and has a non-zero size, and retain the Plotly and Kaleido versions in your build metadata.

3. Keep an interactive companion when needed

fig.write_html("figure.html")

The HTML file preserves hover labels, pan and zoom, and legend toggling. A PDF cannot preserve those interactions, so publishing both files is usually the clearest choice for an analytical report.

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

Make the PDF genuinely vector where possible

Most ordinary Plotly traces render as vector content in a PDF. WebGL traces can put rasterized portions inside an otherwise vector document. Plotly Express may switch scatter-type figures to WebGL above 1,000 data points. If selectable, infinitely scalable marks are important, force SVG rendering where the trace supports it:

import plotly.express as px

fig = px.scatter(
    df,
    x="x",
    y="y",
    render_mode="svg"
)
fig.write_image("scatter.pdf")

You can also build the trace explicitly with go.Scatter. This trades some WebGL performance for vector output. Inspect the exported PDF at high zoom; a rasterized layer is not necessarily an export failure, but it will not scale like paths and text.

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⁴

Convert a full HTML page or dashboard with Playwright

Use browser printing when the input is an entire document: a dashboard route, a server-rendered report, or HTML that combines Plotly charts with tables, logos and explanatory text. Playwright’s page.pdf() uses print CSS media by default.

Install Playwright and Chromium

npm install playwright
npx playwright install chromium

Minimal JavaScript exporter

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();

  await page.goto('http://localhost:3000/report', {
    waitUntil: 'networkidle'
  });

  await page.pdf({
    path: 'report.pdf',
    format: 'A4',
    printBackground: true,
    preferCSSPageSize: true
  });

  await browser.close();
})();

For a public page, replace the example URL with the report URL. For a local dashboard, start its web server before this script. networkidle waits for network activity to settle, but it is not a guarantee that a chart’s asynchronous data or web fonts are ready; add an application-specific readiness check.

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

Wait for data, fonts and charts explicitly

await page.goto('http://localhost:3000/report', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('[data-report-ready]');
await page.evaluate(() => document.fonts.ready);
await page.pdf({
  path: 'report.pdf',
  format: 'A4',
  printBackground: true,
  preferCSSPageSize: true
});

Set data-report-ready in your application only after the Plotly figures have finished rendering and their data requests have completed. This avoids PDFs containing empty chart containers or fallback fonts.

Control screen versus print styling

Print CSS is normally the desired source for a document. If the screen layout is the one you want, switch media before printing:

await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'screen-layout.pdf', printBackground: true });

Define page dimensions and breaks in your stylesheet:

@page {
  size: A4;
  margin: 16mm 14mm 18mm;
}

@media print {
  nav, .chat-widget, .no-print { display: none !important; }
  .chart { break-inside: avoid; }
  h2 { break-before: page; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

Use printBackground: true for colored panels and chart backgrounds. preferCSSPageSize: true lets the @page rule win over the API’s default paper size.

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.

Useful page.pdf() options

  • Paper: choose format such as A4 or Letter, or provide explicit width and height.
  • Margins: set top, right, bottom and left values to keep headers and charts clear of the edge.
  • Orientation: use landscape: true for wide dashboards.
  • Page ranges: use pageRanges when only selected pages belong in the deliverable.
  • Headers and footers: enable the display-header/footer option and provide templates when the document needs page numbers or a title.
  • Scale: adjust scale cautiously; shrinking a dense dashboard can make labels unreadable.

Plotly PDF versus browser PDF: practical trade-offs

Decision Plotly/Kaleido Playwright/Chromium
Input scope One figure object Entire HTML document or dashboard
Layout control Figure dimensions and export scale CSS, paper size, margins, headers, footers and page ranges
Interactivity None in the PDF None in the PDF; browser HTML remains interactive
Typical failure Missing Chrome or a WebGL raster layer Unfinished data, fonts, print CSS or page breaks

Choose Kaleido when the deliverable is precisely a chart. Choose Playwright when surrounding HTML, responsive layout or multiple charts must be printed together.

Or skip the browser setup

ScreenshotNeo can render a URL to PNG, JPEG, WebP or PDF through one request. Its PDF options include paper size, margins, landscape mode and page ranges, while wait controls let you wait for a selector, a delay or network idle.

cURL

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

See the ScreenshotNeo API documentation for authentication and the complete parameter list. The same endpoint accepts custom CSS and JavaScript, clicks an element before capture, hides selectors, loads lazy images for full-page captures, blocks ads, trackers, requests or resource types, and accepts custom headers, cookies, user agents, Authorization, timezone and geolocation. You can also resize images, choose transparent backgrounds, cache with a TTL, create signed links for public image tags, submit asynchronous jobs with signed webhooks, capture up to 100 URLs per bulk call, query usage and use the OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("report.pdf", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://stripe.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const fs = require('node:fs/promises');
await fs.writeFile('report.pdf', Buffer.from(await res.arrayBuffer()));

Before capture, ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed. Every response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

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

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to start without a card.

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

Troubleshooting checklist

“Chrome executable not found” from Kaleido

Kaleido v1 does not bundle Chrome. Install Chrome or Chromium in the machine or CI image, then run plotly_get_chrome (or call plotly.io.get_chrome()). Verify the browser is executable by the same user that runs Python.

The PDF contains a blank chart

For Kaleido, confirm the figure has data before calling write_image. For Playwright, wait for the application’s chart-ready selector, data requests and document.fonts.ready; a generic network-idle event can occur too early.

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

Colors or navigation disappear

That is usually print CSS. Add explicit @media print rules, hide navigation intentionally, and set printBackground: true. If the screen design is required, call page.emulateMedia({ media: 'screen' }).

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

Wide charts are clipped or unreadable

Use landscape paper, explicit chart dimensions and sensible margins. Avoid compensating only with a very small global scale; split a dashboard into intentional sections or page breaks.

Text looks fuzzy in an otherwise sharp PDF

Inspect the trace type. WebGL can rasterize chart layers, and Plotly Express may select WebGL above 1,000 scatter points. Use render_mode="svg" or a go.Scatter trace when vector marks are required.

Authenticated or private HTML will not load

In Playwright, create a browser context with the required cookies or extra HTTP headers before calling page.goto. In an API workflow, pass the target page’s supported headers, cookies or Authorization values and ensure the URL is reachable from the rendering service.

Repeated captures are slow or expensive

Wait only for the readiness condition you need, block unnecessary resources and use caching where the content can tolerate a chosen TTL. For many URLs, ScreenshotNeo’s bulk endpoint accepts up to 100 URLs per call and asynchronous jobs can notify your system through signed webhooks.

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

Production and cost considerations

  • Reproducibility: pin Plotly, Kaleido, Playwright and browser versions in CI, and keep print CSS with the report code.
  • Reliability: give pages deterministic readiness markers instead of relying solely on time delays.
  • Quality checks: verify PDF existence, file size, page count and representative chart text or dimensions in automated pipelines.
  • Security: treat URLs, cookies and Authorization headers as secrets; avoid logging full query strings containing access keys.
  • Delivery: provide the static PDF for printing and the HTML companion for exploration whenever interaction is part of the reader’s task.

Frequently Asked Questions

How can I verify a PDF export in continuous integration?

After the export call, assert that the file exists and is non-empty, then inspect the page count and a representative rendered page or text extraction. Keep the browser and plotting-library versions fixed so layout changes are intentional.

Can a private dashboard be exported without making it public?

Yes. Load it in a browser context carrying the session cookies or request headers required by the application, or pass supported authentication headers and cookies to your rendering service. Keep those credentials out of logs and source control.

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 *

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.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
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.