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.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

For a normal “Save as PDF” button, call window.print() and let the user choose a PDF printer in the browser’s print dialog. JavaScript cannot use that API to silently write a PDF file. If your code must create a file or PDF buffer without user interaction, use an automated browser such as Puppeteer or Playwright. If the export must happen entirely in the browser and download immediately, html2pdf.js is an option, with important rendering and text limitations.

The right method depends on who controls the save operation, how faithfully the page must match browser layout, and whether you need a whole page or one element.

Choose the PDF method first

Requirement Best fit What happens
A user clicks a button and chooses where to save window.print() plus print CSS The browser opens its print dialog. The user selects “Save as PDF” or an operating-system equivalent.
A browser-only app must generate a downloadable PDF html2pdf.js The selected DOM is rendered through canvas and placed into a PDF, then downloaded.
A server, queue, test, or batch job must create a file or buffer Puppeteer or Playwright Automation launches a browser, loads the page, and returns PDF bytes or writes a file.

Test representative pages before choosing: long tables, web fonts, lazy images, SVG, videos, cross-origin images, page breaks, and content that appears after an API request can behave differently in each path.

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

Save the current page with the browser print dialog

For an ordinary user-facing feature, this is the smallest and most reliable implementation. The MDN Window.print() API “opens the print dialog to print the current document.” If the document is still loading, the browser finishes loading before opening the dialog, and the call blocks while the dialog is open.

#1 Best Overall
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
  • 1 ream (500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing

Minimal button

<button type="button" onclick="window.print()">Save as PDF</button>

The destination and filename are controlled by the browser or operating system. Do not promise a universal automatic download: browsers intentionally keep that decision in the print interface.

Hide controls and tune paper output

@media print {
  .no-print,
  nav,
  footer {
    display: none !important;
  }

  main {
    width: auto;
  }
}

@page {
  margin: 12mm;
}

Put the rules in the page stylesheet or in a stylesheet linked with media="print". Use @media print for print-only changes and @page for paper dimensions, orientation, and margins. Browser print settings can still override some choices.

Adjust the interface only while printing

window.addEventListener("beforeprint", () => {
  document.body.classList.add("is-printing");
});

window.addEventListener("afterprint", () => {
  document.body.classList.remove("is-printing");
});

Use these events sparingly. A print stylesheet is easier to reason about and avoids leaving the screen in a temporary state if a user cancels.

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

Generate a browser-side download with html2pdf.js

html2pdf.js runs in a browser and follows a documented pipeline: source element, cloned container, canvas, image, PDF, and save. It depends on html2canvas and jsPDF. Although it can be installed in a Node-based project, the conversion itself requires a browser environment.

Export one element

<button id="export" type="button">Download PDF</button>
<article id="content-to-export">
  <h1>Invoice</h1>
  <p>Content to export.</p>
</article>
<script src="path/to/html2pdf.bundle.min.js"></script>
<script>
  document.getElementById("export").addEventListener("click", () => {
    const element = document.getElementById("content-to-export");
    html2pdf().from(element).save();
  });
</script>

Configure the release you install deliberately. The README documents options for margins, filename, image type and quality, html2canvas scale, and jsPDF paper format and orientation:

Rank #2
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
  • HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America. Each ream is wrapped in a polyurethane coated paper wrapper to protect the cut sheets from moisture damage
  • Sheet size – 8.5 x 11; Thickness – 20 pounds; Brightness – 92 bright white
  • HP Copy&Print20 20 pounds printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design)
  • All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment; 100% satisfaction guaranteed; ColorLok technology provides more vivid colors, bolder blacks and faster drying
  • Superior quality, reliability, and dependability for high-volume printing at home, at school and in the office; HP Copy&Print20 print and copy paper prevents yellowing over time to ensure a long-lasting appearance for added archival quality
const element = document.getElementById("content-to-export");

html2pdf()
  .set({
    margin: 12,
    filename: "invoice.pdf",
    image: { type: "jpeg", quality: 0.95 },
    html2canvas: { scale: 2 },
    jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }
  })
  .from(element)
  .save();

Know the trade-offs

  • The rendered page content is placed as an image. Text is therefore not selectable or searchable in the resulting PDF, and files can be large.
  • Rendering is not a complete browser print engine. The project documents imperfect rendering, cloned-node CSS issues, root resizing that can cause reflow, and blank output when canvas dimensions are exceeded.
  • Complex fonts, very wide elements, huge images, and long single-page layouts are common stress cases. Split content, reduce scale, constrain widths, or use an automated browser when document fidelity matters.
  • Cross-origin images need to be usable by the browser’s canvas security rules. If an image is blocked, it may be missing from the PDF.

Create a PDF file or buffer with Puppeteer

Puppeteer is intended for code-controlled browser sessions. Its PDF guide shows the sequence: launch a browser, create a page, navigate, then call page.pdf(). PDF generation uses print CSS by default, returns PDF bytes, and waits for fonts by default.

Node.js file example

import puppeteer from "puppeteer";

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto("https://example.com", { waitUntil: "networkidle0" });
  await page.pdf({
    path: "page.pdf",
    format: "A4",
    printBackground: true,
    margin: { top: "12mm", right: "12mm", bottom: "12mm", left: "12mm" }
  });
} finally {
  await browser.close();
}

Use a URL your job is authorized to access. For an authenticated page, establish the session before navigation (for example, with a cookie or login flow). Wait for the application’s own ready condition when network idle is insufficient, and ensure images and fonts have finished loading before calling page.pdf().

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

Return bytes instead of writing a file

const pdfBuffer = await page.pdf({
  format: "A4",
  printBackground: true
});
// Store pdfBuffer, upload it, or send it in an HTTP response.

Use print media by default. If the page needs screen styling, emulate screen media before generating the PDF, then verify colors and spacing.

Create a PDF with Playwright

Playwright’s page.pdf() also returns a PDF buffer and uses print CSS. Its options include paper format, explicit dimensions, margins, and print-color behavior. To render screen media, call the page’s media-emulation method before PDF generation.

import { chromium } from "playwright";

const browser = await chromium.launch();
try {
  const page = await browser.newPage();
  await page.goto("https://example.com", { waitUntil: "networkidle" });
  await page.emulateMedia({ media: "print" });
  const pdf = await page.pdf({
    format: "A4",
    printBackground: true,
    margin: { top: "12mm", right: "12mm", bottom: "12mm", left: "12mm" }
  });
  // writeFile("page.pdf", pdf) or return pdf from a route
} finally {
  await browser.close();
}

These APIs belong to an automated browser process, not to ordinary JavaScript running inside a visitor’s tab. Your deployment must provide a compatible browser binary, enough memory, and a lifecycle policy that closes pages and browsers after each job or worker batch.

Rank #3
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
  • 3 ream case (1,500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing

Control layout, loading, and page breaks

Use print-specific CSS

@media print {
  .no-print { display: none !important; }
  a { color: inherit; text-decoration: none; }
  .avoid-break { break-inside: avoid; }
}

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

Keep critical content in normal flow. Absolutely positioned panels, sticky headers, and viewport-height sections often need print overrides.

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

Wait for asynchronous content

A page can be technically “loaded” while data, images, or fonts are still arriving. In automation, wait for a selector that marks completion, an application promise exposed for testing, or an explicit delay as a last resort. In a browser-side library, disable the export button until the page’s own loading state is complete.

Whole page versus one element

Print and automated-browser methods naturally represent the document. html2pdf.js can start from a selected element. For invoices, reports, or receipts, select a stable container and avoid exporting navigation, dialogs, and live controls.

Troubleshooting common failures

The button opens print, but no PDF downloads

This is expected. window.print() opens a dialog; the user must choose a PDF destination. If a silent or server-controlled file is required, switch to Puppeteer or Playwright.

Print output contains navigation or buttons

Add a .no-print class and hide it under @media print. Also check that component styles are not using higher-specificity rules or inline !important declarations that keep controls visible.

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

html2pdf.js output is blurry or huge

Increase or decrease html2canvas.scale deliberately. A larger scale can improve detail but increases memory and file size. Prefer JPEG for photographic pages when acceptable; use PNG when sharp flat graphics or transparency matters.

Rank #4
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 5 Reams (2,500 Sheets), 92 Bright White
  • 5 ream case (2,500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing

html2pdf.js produces blank pages

Check for an element or canvas larger than browser canvas limits, an extremely wide layout, or a failed image load. Constrain dimensions, split the export into sections, lower the scale, and test images individually. Move to Puppeteer or Playwright for very long or complex documents.

Fonts or images are missing in automation

Wait for fonts and the application’s image-ready condition. Confirm the browser process can reach every asset, credentials are present, and cross-origin responses permit the requested resource. Capture a diagnostic screenshot before PDF generation to see what the automated page actually rendered.

The PDF has screen colors or unexpected margins

PDF APIs use print CSS by default. Inspect @media print rules, explicitly set margins and paper format, and emulate screen media only when that is the desired result. Browser print settings can still alter user-initiated output.

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.

Performance, reliability, and cost decisions

  • Print dialog: no conversion service or browser process for you to operate, but the user must remain in the flow and save manually.
  • html2pdf.js: convenient for a client download, but canvas rendering consumes the tab’s memory and image-based PDFs can be large. There is no universal speed or fidelity guarantee; test your content.
  • Puppeteer/Playwright: suitable for repeatable jobs and buffers, with more operational work. Reuse a controlled browser worker where safe, cap concurrent pages, close resources in error paths, and set navigation and job timeouts.

Measure your own representative documents rather than quoting a generic benchmark. Compare file size, completion time, page count, fonts, images, tables, and page breaks in the browsers and deployment environments you actually support.

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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF, so you do not need to package and maintain a browser for a straightforward URL capture. It accepts cookie and consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result.

See the complete parameter list in the ScreenshotNeo documentation. For a PDF response, request the PDF format in your query:

Best Value
HP Printer Paper | 8.5 x 11 Paper | Office 20 lb | 3 Ream Case - 1500 Sheets | 92 Bright | Made in USA - FSC Certified | 112090C, White
  • Made in USA: HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America.
  • Optimized for HP technology: All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment.
  • Perfect everyday office paper: Superior quality, reliability, and dependability for high-volume printing at home, at school and in the office. Perfect for everyday black and white printing.
  • Certified sustainable: HP Office20 20lb printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design).
  • ColorLok technology printing paper: ColorLok technology provides more vivid colors, bolder blacks and faster drying.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o page.pdf

The same endpoint works from application code:

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
r.raise_for_status()
open("page.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`ScreenshotNeo: ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());

ScreenshotNeo also supports full-page captures with lazy images loaded, element selectors, custom CSS and JavaScript, waits, headers, cookies, user agents, authorization, blocking rules, time zones, geolocation, resizing, caching, signed links, asynchronous jobs, webhooks, bulk capture, and an MCP server with take_screenshot, get_page_info, and capture_pdf for AI clients such as Claude and Cursor.

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

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Create a free ScreenshotNeo account to get started.

Frequently Asked Questions

Can JavaScript save a PDF without opening the print dialog?

Not with the browser’s built-in window.print(). Use html2pdf.js for a client-side download or Puppeteer/Playwright for programmatic PDF bytes.

How do I export only one HTML element?

Pass that element to html2pdf.js with .from(element), or create a dedicated route/container and print it with an automated browser.

Which approach preserves selectable text?

Automated-browser PDF APIs preserve normal PDF text more directly. html2pdf.js documents image-based output, so its text is not selectable or searchable.

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

Why does my PDF differ from the screen?

PDF generation normally uses print CSS. Review @media print, @page, font loading, margins, and whether screen media must be emulated.

Quick Recap

Bestseller No. 1
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
1 ream (500 sheets) of 8.5 x 11 white copier and printer paper for home or office use; Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$6.97
Bestseller No. 2
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
Sheet size – 8.5 x 11; Thickness – 20 pounds; Brightness – 92 bright white
$6.97
Bestseller No. 3
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$23.99
Bestseller No. 4
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 5 Reams (2,500 Sheets), 92 Bright White
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 5 Reams (2,500 Sheets), 92 Bright White
Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$34.85

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.