Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober 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

How to Preview HTML Code as a PDF (Browser, Puppeteer, Acrobat, and ScreenshotNeo)

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

The fastest way to preview HTML as a PDF is to open the page in a browser, choose Print, and inspect the print preview with a PDF destination selected. For repeatable previews, use Puppeteer’s page.pdf(); for conversion controls, Acrobat desktop is another option. Remember that PDF output normally uses print CSS, so it can differ from what you see on screen.

Preview HTML as a PDF in a browser

This method is best for a one-off visual check. It works for a public page and, in most browsers, for a local .html file.

  1. Open the HTML in its intended environment. Double-click a self-contained local file, or run your application if it depends on JavaScript, a backend route, local assets, authentication, or a build step. Previewing an incomplete local file can hide problems that occur in the real app.
  2. Open the print dialog. Use the browser’s Print command or its keyboard shortcut. The exact label and shortcut depend on the browser and operating system.
  3. Choose a PDF destination. Select a Save as PDF or PDF destination option when your platform provides one. You can inspect the preview before saving.
  4. Check the important print settings. Review paper size, portrait or landscape orientation, margins, scale, background graphics, headers and footers, and page ranges.
  5. Inspect every page. Look for clipped wide elements, headings stranded at the bottom of a page, missing images, broken fonts, unexpected blank pages, and links or colors that changed.
  6. Adjust print CSS or settings and preview again. Treat the preview as a rendering test, not merely a confirmation that a file was created.

Print-specific CSS to add before previewing

Use a print stylesheet when the screen layout is not suitable for paper. For example:

@media print {
  nav, .chat-widget, .cookie-banner { display: none; }
  body { color: #111; background: #fff; }
  .report { max-width: none; }
  .avoid-break { break-inside: avoid; }
  h1, h2 { break-after: avoid; }
}

Keep important content in normal document flow. Absolutely positioned panels, fixed overlays, and horizontally scrolling containers are common sources of bad PDF pages.

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

What to check in print preview

Check What can go wrong Typical adjustment
Page size A4 content may paginate differently on Letter paper, or vice versa. Select the required paper size and test again.
Orientation Tables and dashboards can be clipped in portrait mode. Use landscape or redesign the wide component.
Margins Text or borders can approach the printable edge. Increase margins or reduce scale.
Scale Automatic shrinking can make text unreadable. Prefer a deliberate scale and responsive widths.
Backgrounds Cards, colored sections, and images may disappear. Enable background graphics and verify print CSS.
Page breaks Rows, headings, or cards split awkwardly. Use break-inside: avoid selectively; do not prevent breaks on huge blocks.
Assets Web fonts, lazy images, or relative URLs may not load. Run the page from its intended server and wait for assets before printing.

Why a PDF can look different from the browser page

PDF generation is usually a print rendering operation. Print media rules can change display, colors, dimensions, and visibility. Puppeteer documents this explicitly: Page.pdf() generates a PDF with the print CSS media type. Printing can also modify colors unless the page requests exact color adjustment.

If the PDF should match the screen design, add screen emulation in Puppeteer before generating it:

await page.emulateMediaType('screen');

For color-sensitive pages, consider:

html {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

These declarations improve consistency but do not override browser, operating-system, or PDF-viewer behavior in every situation. Always inspect the actual output.

Automate the preview with Puppeteer

Puppeteer is a practical choice when you generate previews repeatedly in a JavaScript or Node.js workflow. Install it in your project, then create a script such as this:

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.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({ headless: true });
try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: 1 });
  await page.goto('http://localhost:3000/report', {
    waitUntil: 'networkidle0',
    timeout: 60000
  });

  // Use this line when the PDF should follow screen CSS.
  await page.emulateMediaType('screen');

  await page.pdf({
    path: 'report-preview.pdf',
    format: 'A4',
    printBackground: true,
    margin: { top: '16mm', right: '14mm', bottom: '16mm', left: '14mm' },
    preferCSSPageSize: true
  });
} finally {
  await browser.close();
}

Run the script against the same environment your users will see. Replace networkidle0 with an explicit readiness check when the page keeps analytics or streaming connections open:

Rank #2
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)
await page.goto('http://localhost:3000/report', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('.report-ready', { timeout: 30000 });

Print media versus screen media

  • Leave the default behavior when you want the PDF to honor print styles.
  • Call page.emulateMediaType('screen') when the preview should resemble the screen layout.
  • Use printBackground: true when backgrounds are part of the design.
  • Use preferCSSPageSize: true when your CSS defines an intentional @page size.

Use an explicit page definition when needed

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

@media print {
  .invoice-line { break-inside: avoid; }
}

Do not combine a CSS page size, a browser format, and aggressive scaling without checking which rule wins in your target environment.

Preview a local HTML file reliably

A file opened with a file:// URL can behave differently from a deployed page. Relative assets, module imports, CORS rules, cookies, and server-side data may fail. A small local server is safer:

python -m http.server 8000

Then open http://localhost:8000/ and print that page. If your application needs a backend, start the application itself and navigate to its real route. Wait for fonts, images, and client-side rendering before opening print preview or calling page.pdf().

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

Use Acrobat when you need conversion controls

Acrobat desktop can convert a URL or browse to an HTML file. Its web-page conversion settings expose controls for encoding, fonts, default colors, retaining page backgrounds, image handling, links, expansion of scrollable blocks, page size, orientation, margins, and scaling wide content to fit.

This route is useful when a browser’s basic print dialog does not give enough control over scrollable regions, backgrounds, or page layout. It is still important to inspect the resulting pages because HTML that depends on application state, authentication, or delayed JavaScript may not be captured as expected.

Rank #3
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

Developer APIs for repeatable HTML-to-PDF work

Puppeteer is a browser-automation option for scripted rendering. Adobe PDF Services API is another documented developer-oriented route for static or dynamic HTML, ZIP packages, and URLs. Choose based on your runtime, authentication model, deployment requirements, and need for browser-level control. The available documentation does not establish a universal winner for quality, speed, or price.

Or skip the browser setup: ScreenshotNeo

ScreenshotNeo can return a screenshot or PDF from one GET request. It is useful when you need a remote preview without installing a browser. Before capture, it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

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

Here is a complete cURL request (replace the URL with your page):

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

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("shot.webp", "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 data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', data));

See the ScreenshotNeo documentation for request parameters and PDF options. Its 63 options include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, paper size, margins, landscape mode, page ranges, custom CSS and JavaScript, click actions, hidden selectors, selector or network-idle waits, ad and tracker blocking, custom headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.

Every plan includes every feature. The Free plan provides 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Yearly billing provides two months free. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting PDF previews

The PDF is blank

  • Confirm the URL is reachable from the rendering environment.
  • Wait for client-side rendering and fonts before capture.
  • Check authentication, redirects, mixed-content errors, and failed API requests.
  • For Puppeteer, wait for a page-specific readiness selector rather than relying only on a network-idle event.

Colors or backgrounds are missing

Enable background graphics in the browser, set Puppeteer’s printBackground: true, and check whether print CSS intentionally changes colors. Use print-color adjustment only when exact colors matter.

Content is cut off or too wide

Try landscape orientation, a suitable paper size, or a responsive print layout. Avoid forcing a fixed desktop width. Acrobat’s scaling-to-fit option can help, but shrinking an entire page may make text too small.

Images or fonts are missing

Use absolute or correctly resolved asset URLs, serve the page over HTTP, wait for resources, and verify that the rendering process can access protected assets. Lazy-loaded images may require scrolling or an explicit wait before PDF generation.

Pages break in the wrong places

Use break-before, break-after, and break-inside on modest-sized components. Test long tables and avoid applying break-inside: avoid to containers larger than one page.

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

The result differs between machines

Pin browser versions where possible, use the same fonts and viewport, and define paper size, margins, scale, and media type explicitly. PDF viewers and operating systems can still display subtle differences.

Best Value
Sale
ScanSnap iX2500 Wireless or USB High-Speed Document Scanner, Black
  • OUR MOST ADVANCED SCANSNAP. Large touchscreen, fast 45ppm double-sided scanning, 100-sheet document feeder, Wi-Fi and USB connectivity, automatic optimizations, and support for cloud services. Upgraded replacement for the discontinued iX1600
  • CUSTOMIZABLE. SHARABLE. Select personalized profiles from the touchscreen. Send to PC, Mac, mobile devices, and clouds. QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
  • STABLE WIRELESS OR USB CONNECTION. Built-in Wi-Fi 6 for the fastest and most secure scanning. Connect to smart devices or cloud services without a computer. USB-C connection also available
  • PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. Easily manage, edit, and use scanned data from documents, receipts, photos, and business cards. Automatically optimize, name, and sort files
  • AVOIDS PAPER JAMS AND DAMAGE. Features a brake roller system to feed paper smoothly, a multi-feed sensor that detects pages stuck together, and skew detection to prevent paper damage and data loss

Choosing the right preview method

Need Best starting point Reason
One visual check Browser print preview Fastest setup and immediate inspection.
Repeatable JavaScript workflow Puppeteer Automates navigation, waits, media emulation, and PDF settings.
Desktop conversion controls Acrobat Offers additional layout and content options.
Remote capture without browser setup ScreenshotNeo One request, cleanup of common overlays, usage headers, PDF support, and an MCP server.

Frequently Asked Questions

Should I preview with print CSS or screen CSS?

Use print CSS when the PDF is intended for paper or formal distribution. Use screen emulation when visual fidelity to the on-screen page is the priority, then check pagination separately.

Can I preview HTML that requires login?

Yes, but the renderer must receive the required session or authentication context. In a local browser, sign in normally; in automation or an API, provide supported cookies or headers and protect those credentials.

Why does a long webpage create unexpected blank pages?

Common causes include oversized fixed-height elements, forced page breaks, print-only margins, or content that cannot fit inside a page box. Inspect computed print styles and remove unnecessary fixed heights or break rules.

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

The Bottom Line

Start with browser print preview for a manual check. Use Puppeteer for repeatable control, Acrobat for desktop conversion settings, or ScreenshotNeo when a hosted one-call capture is more practical.

Quick Recap

Bestseller No. 4
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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.