To preserve an HTML page’s layout in a PDF, choose whether you want its screen appearance or a print-ready document, then configure the renderer and CSS to match. Puppeteer and Playwright generate PDFs with print CSS by default; define page size, margins, page breaks, and screen-only elements deliberately, wait for content to load, and inspect the resulting pages for clipping and awkward breaks.
Decide what “preserve the layout” means
A responsive web page is designed for a changing viewport, not automatically for fixed sheets of paper. A PDF export therefore involves a choice:
As an Amazon Associate I earn from qualifying purchases.
- Keep the screen composition: use screen styles when the existing on-screen arrangement is the intended result. A wide or long page may still be split awkwardly across paper pages.
- Create a readable paginated document: use print styles to set page dimensions, margins, breaks, and which interface elements should be omitted or restyled.
Neither goal is universally right. Choose based on what the PDF is for, then review the actual output rather than assuming the browser’s rendering will match the page on screen.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsUse Puppeteer or Playwright for browser-rendered pages
Both tools can render a page in a browser and save it as a PDF. Their PDF methods use print CSS by default. Puppeteer’s Page.pdf documentation describes the behavior directly: “Generates a PDF of the page with the print CSS media type.” See the Puppeteer Page.pdf API and Playwright Page API.
#1 Best Overall
- Convert your PDF files into Word, Excel & Co. the easy way
- Convert scanned documents thanks to our new 2022 OCR technology
- Adjustable conversion settings
- No subscription! Lifetime license!
- Compatible with Windows 11, 10, 8.1, 7 - Internet connection required
Prepare print CSS
Add a print stylesheet for paper-specific rules. For example, this CSS requests A4 pages with defined margins, avoids splitting headings from the next element where feasible, and suppresses navigation and controls:
@media print {
nav,
.controls,
.screen-only {
display: none !important;
}
h1, h2, h3 {
break-after: avoid;
}
figure, table {
break-inside: avoid;
}
img {
max-width: 100%;
}
}
@page {
size: A4;
margin: 16mm;
}
These are starting rules, not a guarantee that every table, image, or heading will fit on one page. Content too large for a page may still need to break or overflow, so check the rendered PDF and adjust the rules for the document.
Generate a PDF with Puppeteer
Install Puppeteer in a Node.js project, then use a script such as the following. It waits for network activity to settle, gives the page a moment for delayed rendering, and writes the resulting PDF. Replace the URL and output path for your task.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Rank #2
- RCA Female to HDMI Video Converters Adapter : The cable is used to convert analog composite input to HDMI 1080p output, displayed on a 1080p HD TV/TV/monitor.
- Input ports: 1xRCA Female (Yellow, White, Red), Output ports: 1xHDMI 1.3 1080p. NOT support 3D and 4K, NOT support HDMI Converts to AV
- AV to HDMI Converter: Plug and Play, Easy to Install and Operate, Powered by External USB Cable. Note: Please hook up the USB power cable (included) to 5V 1Apower source during use (not included power supply ).
- Support PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N standard TV formats input. For PS2,PS3,Xbox,N64,STB, VHS, VCR, DVD Players and other devices with standard composite AV input.
- You Will Get : 1x RCA Female TO HDMI Converter, 1xHDMI cable, 1xUSB cable, 1xUser Manual. ONE YEAR WARRANTY - if you are not satisfied for any reason whatsoever, do not hesitate to contact us .
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: true });
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.waitForTimeout(500);
await page.pdf({
path: 'page.pdf',
preferCSSPageSize: true,
printBackground: true
});
} finally {
await browser.close();
}
})();
The delay is only an example; use a readiness condition that fits the page. For applications that render content after navigation, wait for a meaningful selector or application state before calling page.pdf(). Confirm the installed Puppeteer version supports the methods and options in your script.
Choose screen media only when you want screen styles
If the screen design itself is what you need to preserve, select screen media before producing the PDF. In Puppeteer, call page.emulateMediaType('screen') before page.pdf(). In Playwright, call page.emulateMedia({ media: 'screen' }) before page.pdf(). The result can still paginate a screen-sized canvas across sheets; test the page width, scaling, and page breaks in the PDF.
Set page size and backgrounds separately
Puppeteer’s current PDF options reference says preferCSSPageSize defaults to false. Set it to true when the dimensions in CSS @page should take priority over PDF options such as format, width, or height. That option controls page sizing; it does not enable backgrounds.
Rank #3
- AUDIO ALL-ROUNDER – convert your audio or video files into almost any audio format - edit, trim, merge, adjust sample and bit rate, extract audio from videos
- Supported input formats - MP3, MP2, AAC, AC3, WAV, WMA, M4A, RM, RAM, OGG, AU, AIF, AIFF, PG, MPEG, MPEG 2, MP4, M4V, MJPG, MJPEG, HD TS, HD MTS, HD M2TS, HD MPG, HD MPEG, HD MP4, HD WMV, QuickTime HD MOV and others
- Supported output formats - AAC, AC3, AIFF, AMR, AU, FLAC, M4A, MKA, MP2, MP3, OGG, WAV, WMA
- EASY TO INSTALL AND USE - user-friendly and intuitive interface, free tech support whenever you need assistance
- compatible with Windows 10, 8 and 7 (32 and 64-bit versions) - single user license
Puppeteer’s printBackground defaults to false. Set printBackground: true when background colors or images are part of the intended design. Print rendering may also change colors. The Puppeteer and Playwright documentation points to -webkit-print-color-adjust for exact color rendering; check the output because the setting alone does not guarantee a match. References: Puppeteer PDFOptions, Puppeteer Page.pdf, and Playwright Page.
Use Prince when the job is print-oriented publishing
Prince is a print-oriented option for converting HTML, Markdown, and XML styled with CSS into PDF. Its guide also describes JavaScript for transformations and server-side integration. Consider it when a workflow depends on paged-media styling, then check its current requirements, licensing, version, and support for the specific features your documents need. The available product guide does not establish current pricing or a universal performance or fidelity advantage.
See the Prince User Guide. Puppeteer and Playwright are documented browser-automation routes; Prince is documented as a dedicated web-standards-to-PDF product. These sources do not provide a controlled comparison across fidelity, accessibility, speed, CSS coverage, or price, so validate candidates with representative documents rather than relying on a universal winner.
Rank #4
- RCA to USB Converter: This USB Capture Device can convert anolog RCA composite input into high-definition USB output, the maximum output resolution can reach 1920x1080@30Hz, suitable for camcorders, set-top boxes, boxes, DV camcorders, DVD, VHS, VCD, VCR, DVR and other devices. (Note: Only compatible with NTSC/PAL formats)
- USB2.0 Video Capture: Supports RCA and S-Video input, USB 2.0/Type-C capture, the RCA to USB Capture Card is compatible with most current laptops, ensuring stable video capture and transmission.
- 3.3ft/1m USB Cable: avedio links USB2.0 capture card is equipped with 3.3 feet USB capture cable, reduce the use of troubles caused by short cables and improve operational flexibility.
- Wide Compatibility: Compatible with Windows and MacOS operating systems and supporting video capture software such as OBS, Potplayer, etc., this RCA to USB Capture Card is ideal for video production, screen recording and other scenarios.
- Packing List: RCA&S-Video to USB Capture Card*1, USB A to Type-C converter*1, CD*1, 5ft S-Video Cable*1, RCA Converter*1, User Manual*1.
Check the PDF at page boundaries
Review the generated file, not just the page in a browser. Check:
- Page count, paper dimensions, and margins.
- Clipped, overflowing, or unexpectedly scaled content.
- Headings left at the bottom of a page, split tables, and other awkward breaks.
- Blank pages, repeated or missing headers and footers, and consistency from page to page.
- Missing fonts or glyphs, unloaded images, and colors or backgrounds that differ from the intended design.
- Whether dynamic content, lazy-loaded images, and any application-generated elements appeared before capture.
An HP-sponsored tutorial published in 2015 illustrates why print-specific cleanup can matter: in one Wired article example, removing irrelevant material and styling the remainder reduced the printout from 18 pages to two. That is a historical example for one page, not a general conversion benchmark. See the Print Developers Community tutorial.
Free tools Windows power users keep installed
One-click scans. No signup required.
Troubleshoot common layout problems
The PDF looks different from the browser window
Cause: PDF generation is using print media, which can activate different CSS. Fix: create or adjust @media print rules for a paginated document, or explicitly emulate screen media if the screen composition is the desired output. Check for page-width and scaling problems after switching.
Page dimensions do not match CSS
Cause: the renderer’s PDF size options may take priority over CSS @page dimensions. Fix: in Puppeteer, set preferCSSPageSize: true when CSS should control the page size, and check for conflicting format, width, or height settings.
Best Value
- Convert your VHS tapes to DVD or digital to enhance and preserve your home movies
- Capture analog video directly from your camcorder or VCR and burn to DVD or convert to popular digital formats to share freely across devices
- Trim video, make quick edits, enhance color, add transitions, reduce noise and stabilize old footage to breathe new life into your old videos
- Complete your video experience by selecting from creative, customizable DVD menu templates, or creating personalized disc labels
- Get 2 DVDs for your first projects: An Amazon exclusive extra
Backgrounds are missing or colors look altered
Cause: Puppeteer does not print backgrounds by default, and print rendering can adjust colors. Fix: use printBackground: true where needed and review the browser documentation’s -webkit-print-color-adjust guidance. Inspect the resulting PDF for the specific renderer and content.
Images, fonts, or dynamic sections are absent
Cause: capture began before resources or client-rendered content were ready. Fix: wait for the relevant selector or application state, ensure images and fonts have loaded, and use a page-specific readiness condition. A generic network-idle wait may not signal that every application has finished rendering.
Recommended Free Tools
Content is cut off or breaks badly
Cause: screen-oriented widths, large elements, or unsuitable break rules do not fit the chosen paper size. Fix: review the affected print styles, constrain media to the page width where appropriate, and adjust breaks or element sizing. Re-render and inspect the exact page boundaries.
Or skip the browser setup
ScreenshotNeo is a website screenshot API that also returns PDFs. Use this call for a PDF capture; set the desired PDF options in the request as described in the ScreenshotNeo documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.pdf
ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server provides screenshot and PDF tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. The API captures the rendered page, so for a print-ready multi-page PDF, still define and verify the page’s print layout.
Sign up free for 1,000 screenshots a month, with no card.
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.




