Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Use page.emulateMediaType('print') or page.emulateMediaType('screen') to make a Puppeteer page apply the corresponding CSS media rules. Pass null to clear the override. For PDFs, Puppeteer uses print media by default; select screen media first if the PDF should use screen styling.
Switch a page between print and screen CSS
Call Page.emulateMediaType() on the page and await it before checking page state or generating output. The accepted values are 'print', 'screen', and null. The Puppeteer API reference documents that passing null disables CSS media emulation: Page.emulateMediaType().
As an Amazon Associate I earn from qualifying purchases.
await page.emulateMediaType('print');
await page.emulateMediaType('screen');
await page.emulateMediaType(null);
These calls select which CSS media type the page reports and therefore which matching @media print or @media screen rules apply. They do not send a job to a physical printer.
Free tools Windows power users keep installed
One-click scans. No signup required.
Check which media type is active
Read the media query in the page context with matchMedia(). This is useful for confirming the emulation state before taking a screenshot or creating a PDF.
#1 Best Overall
const state = await page.evaluate(() => ({
print: matchMedia('print').matches,
screen: matchMedia('screen').matches,
}));
console.log(state);
After choosing print, the print query should match; after choosing screen, the screen query should match. Passing null removes the emulated override and restores the browser’s default behavior.
Generate print-styled or screen-styled PDFs
page.pdf() uses print CSS media by default. Usually, you can call it directly to create a PDF intended to follow print styles. To create a PDF using the page’s screen styling, first choose screen media, then call page.pdf(). See Puppeteer’s PDF API reference and PDF generation guide.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
// Print CSS is the default for PDF generation.
await page.pdf({ path: 'print.pdf' });
// Select screen CSS explicitly for the next PDF.
await page.emulateMediaType('screen');
await page.pdf({ path: 'screen-styled.pdf' });
Print-oriented PDF output may adjust colors for printing. Puppeteer’s PDF documentation points to the CSS property -webkit-print-color-adjust when exact colors should be forced. This does not guarantee identical colors across browser versions or output devices.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteComplete example: check both modes and save PDFs
This example navigates to a page, checks the active media query, saves a print-mode PDF, then switches to screen mode for a second PDF. It also clears the media override before reusing the page.
Rank #3
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
await page.emulateMediaType('print');
const isPrint = await page.evaluate(() => matchMedia('print').matches);
console.log({ isPrint });
await page.pdf({ path: 'print.pdf' });
await page.emulateMediaType('screen');
const isScreen = await page.evaluate(() => matchMedia('screen').matches);
console.log({ isScreen });
await page.pdf({ path: 'screen.pdf' });
await page.emulateMediaType(null);
} finally {
await browser.close();
}
Install Puppeteer in the project before running this ES module example, and use the API documentation matching the Puppeteer version installed in that project. Puppeteer’s stable and Next documentation can differ as the API evolves.
Choose the right emulation API
Media type, media features, and device characteristics affect different parts of page rendering. Pick the control that matches the change you want.
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
| Goal | API | What it changes |
|---|---|---|
| Apply print or screen CSS rules | page.emulateMediaType('print') or page.emulateMediaType('screen') |
CSS media type |
| Clear the CSS media override | page.emulateMediaType(null) |
Disables CSS media emulation |
| Change device viewport and user agent | page.emulate(device) |
Device metrics and user agent; Puppeteer recommends applying device emulation before navigation because some sites do not expect viewport changes after load. See Page.emulate(). |
| Set conditions such as dark mode or reduced motion | page.emulateMediaFeatures([...]) |
CSS media feature values, not the media type. See Page.emulateMediaFeatures(). |
| Create a PDF | page.pdf() |
PDF output; print media is the default. |
Troubleshoot media emulation
- Print styles do not appear: await
page.emulateMediaType('print')before checking the page or producing output. Confirm the page’s CSS contains matching@media printrules and verify withmatchMedia('print').matches. - A PDF looks different from the page on screen: that is expected when print CSS is active, because
page.pdf()uses print media by default. Select'screen'before PDF generation if screen styling is the goal. - Dark mode or reduced-motion rules do not change: those are media features rather than media types. Use
page.emulateMediaFeatures()for feature conditions. - The page layout changes after device emulation: device emulation changes viewport and user agent, unlike media-type selection. Apply
page.emulate(device)before navigation where possible. - Subsequent work still behaves as print or screen: call
await page.emulateMediaType(null)to clear the emulation override.
Or skip the browser setup
If you need an image screenshot or PDF without managing Puppeteer, ScreenshotNeo offers a one-request API and an MCP server. Its capture flow accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. AI agents can use its MCP tools, including take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. See the ScreenshotNeo website and API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
Best Value
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.




