Direct answer: put the screenshot in your HTML as an <img> (or a data URL), size it with CSS, and render that page with a browser PDF engine such as Puppeteer. Puppeteer’s page.pdf() uses the print CSS media type by default, so add print rules and explicitly choose page size, margins, colors, and page breaks before writing the PDF.
1. Prepare the screenshot and HTML document
Use a PNG, JPEG, or WebP file that your rendering process can read. A local file, an HTTPS URL, or an embedded data URL all work. An external image must be reachable from the machine running Chromium; a browser on your laptop may be able to see an asset that a server cannot.
Use semantic image markup
Give the image useful alternative text and constrain its width so it cannot overflow the page:
<figure class="screenshot">
<img src="screenshot.png" alt="Checkout page showing the completed order">
<figcaption>Checkout page after payment.</figcaption>
</figure>
.screenshot {
margin: 1rem 0;
break-inside: avoid;
}
.screenshot img {
display: block;
max-width: 100%;
height: auto;
}
max-width:100% preserves the screenshot’s aspect ratio while fitting the content box. Do not set both width and height independently unless distortion is acceptable. For a very wide capture, use a landscape page or deliberately scale it down.
#1 Best Overall
- 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
Embed an image when file access is unreliable
A data URL makes the HTML self-contained, which is useful in a job queue or a temporary directory. It increases HTML size, however, and can make debugging difficult. For normal builds, keeping the image as a file beside the HTML is simpler.
<img src="data:image/png;base64,PASTE_BASE64_DATA_HERE"
alt="Application dashboard screenshot">
2. Add print CSS for the PDF
PDF generation is not a screenshot of the current browser tab. Puppeteer documents that page.pdf() “Generates a PDF of the page with the print CSS media type.” Put PDF-specific rules in @media print, and use @page for the paper geometry.
@page {
size: A4;
margin: 16mm 14mm 18mm;
}
@media print {
.screen-only,
nav,
.cookie-banner {
display: none !important;
}
body {
margin: 0;
color: #111;
background: white;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
h1, h2, h3 {
break-after: avoid;
}
.screenshot {
break-inside: avoid;
}
.page-break {
break-before: page;
}
}
-webkit-print-color-adjust: exact asks Chromium to preserve authored colors. It does not override a reader’s system print settings, so also set Puppeteer’s printBackground: true when backgrounds matter.
3. Render the HTML to PDF with Puppeteer
Install and create a complete script
- Install Node.js and create a project directory.
- Run
npm install puppeteer. The package downloads a compatible Chromium unless your deployment is configured to use an existing browser. - Save the following as
make-pdf.js, replacing the example URL or file paths.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: true
});
try {
const page = await browser.newPage();
await page.setViewport({ width: 1440, height: 1000, deviceScaleFactor: 1 });
// Use a local HTML file, or replace this with page.goto('https://example.com').
await page.goto('file:///absolute/path/to/report.html', {
waitUntil: 'networkidle0'
});
// page.pdf() uses print media by default. Uncomment this when your screen
// stylesheet, rather than @media print, is the intended design.
// await page.emulateMediaType('screen');
// The PDF API can wait for fonts; wait explicitly for every image as well.
await page.evaluate(async () => {
await document.fonts.ready;
const images = Array.from(document.images);
await Promise.all(images.map(img => {
if (img.complete) return img.decode ? img.decode().catch(() => {}) : undefined;
return new Promise(resolve => {
img.addEventListener('load', resolve, { once: true });
img.addEventListener('error', resolve, { once: true });
});
}));
});
await page.pdf({
path: 'report.pdf',
format: 'A4',
printBackground: true,
preferCSSPageSize: true,
margin: { top: '16mm', right: '14mm', bottom: '18mm', left: '14mm' }
});
} finally {
await browser.close();
}
})();
Run it with node make-pdf.js. preferCSSPageSize:true gives your @page rule precedence. If you instead need Puppeteer’s named format, remove that setting and use format:'A4'; do not assume that a CSS page size and an API margin describe the same printable area.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
- 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)
Choose screen or print styling deliberately
Keep the default print media type when you have print rules that remove navigation, adjust typography, and control page breaks. Call await page.emulateMediaType('screen') before page.pdf() when the PDF must match the on-screen stylesheet. This choice explains many cases where an image appears different after printing.
4. Control page geometry and screenshot placement
Paper, orientation, and margins
- Paper: use
format:'A4','Letter', or explicitwidth/height. - Orientation: set
landscape:truefor wide captures, or use@page { size: A4 landscape; }. - Margins: specify them in the PDF options or
@page; keep one source of truth to avoid surprises. - Scale: Puppeteer’s
scalechanges the rendered size. Scaling down can prevent clipping but reduces readability. - Page ranges:
pageRanges:'1-3'exports only selected pages.
Prevent clipping and awkward splits
A screenshot can be cut off when its CSS width exceeds the content box, when a fixed-height container hides overflow, or when a page break lands inside the image. Remove restrictive height/overflow declarations in print CSS, retain height:auto, and apply break-inside:avoid to the figure. If the image is taller than a page, it must either scale down or be intentionally split; avoiding a break cannot make a single oversized image fit.
Preserve colors and backgrounds
Set printBackground:true for CSS backgrounds and gradients. Add the print-color-adjust properties shown above when exact authored colors are important. Background images can still be affected by browser settings or missing network assets, so verify that the asset has loaded before calling page.pdf().
5. Make assets deterministic
- Use absolute paths for local files, or serve HTML and images from a testable HTTP origin.
- Wait for
document.fonts.readyand for image load/decode completion. The PDF options include font waiting, but application code should explicitly wait for images. - Use
waitUntil:'networkidle0'only when the page eventually becomes quiet. Analytics, WebSockets, or polling can prevent that condition; in those cases wait for a specific selector or use a bounded delay. - For authenticated pages, create the browser context with the required cookies or headers before navigation. Never place secrets in a public HTML data URL.
- Pin your Puppeteer/Chromium versions in CI and compare generated PDFs after upgrades; browser layout engines can change line wrapping and pagination.
6. Troubleshooting common failures
The screenshot is missing or broken
Cause: the path is relative to a different working directory, the server cannot reach the URL, or the capture runs before the image loads. Fix: use an absolute file URL or reachable HTTPS URL, log failed requests, and wait for image completion before PDF generation.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #3
- STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
- CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
- HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
- FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
- BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer
The PDF uses the wrong colors or hides backgrounds
Cause: print media rules or Chromium’s print-color behavior. Fix: decide whether to keep print media or call emulateMediaType('screen'), then set printBackground:true and the color-adjust properties.
The image is cut off or spills onto another page
Cause: fixed dimensions, overflow clipping, an oversized source, or margins that leave too little space. Fix: apply max-width:100%; height:auto, remove print-time overflow limits, use landscape orientation, or reduce scale.
Fonts or layout shift between runs
Cause: PDF generation begins before web fonts or late content is ready. Fix: wait for document.fonts.ready, a meaningful application selector, and all required images; avoid unbounded network-idle waits on pages with persistent connections.
Navigation times out
Cause: a page never becomes idle, DNS/TLS failure, or a blocked resource. Fix: inspect the URL from the rendering host, choose a more suitable waitUntil condition, wait for a selector with a timeout, and report the failing request instead of silently creating a partial PDF.
Rank #4
- IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- IRIScan Express mobile scanner is powered via an included micro USB 2. 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. USB cable provided. AC Adapter not provided and not needed.
- IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
- IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
- Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management
7. A hosted alternative: ScreenshotNeo
Or skip the browser setup
ScreenshotNeo returns a PNG, JPEG, WebP, or PDF from one GET request. It accepts cookie and consent banners like a visitor, removes more than 60 known consent platforms plus newsletter popups and chat widgets, and lets you turn each cleanup step off. Only clean shots are billed: bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing; response headers identify the page verdict and billing status.
For a PDF, request the PDF output and set the relevant capture options. The same API supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets or any viewport, retina scale, paper size, margins, landscape, page ranges, custom CSS and JavaScript, pre-capture clicks, selector hiding, selector/delay/network-idle waits, request and resource blocking, custom headers/cookies/user agents/Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture of 100 URLs per call, usage reporting, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.
One-call examples
See the complete option reference 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.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
8. Choosing between local Puppeteer and a hosted capture
| Consideration | Puppeteer in your environment | ScreenshotNeo |
|---|---|---|
| CSS fidelity | Chromium rendering with complete control of your document and print CSS | Hosted browser capture with PDF and extensive page options |
| Page geometry | Direct control through CSS and page.pdf() |
PDF paper size, margins, orientation, and page ranges through API options |
| Asset readiness | You implement waits for images, fonts, and application state | Capture service handles browser loading and reports verdict/billing headers |
| Operations | You maintain Chromium, sandboxing, queues, and retries | One HTTP request or MCP tool; usage and caching options are built in |
| Billing model | Your compute and maintenance costs | 1,000 free monthly shots; paid tiers start at $5 for 3,000 |
Use Puppeteer when the HTML, browser, and data must remain inside your infrastructure or when you need custom application logic around rendering. Use ScreenshotNeo when a maintained capture endpoint, clean output, and agent-accessible tools are more valuable than operating Chromium yourself.
Best Value
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
FAQ
Can I add several screenshots to one PDF?
Yes. Put each image in its own figure or section and use page-break rules to control whether a new screenshot starts on a fresh page.
Should I use PNG or JPEG?
PNG is usually clearer for interface text and sharp edges; JPEG is smaller for photographic content. WebP can reduce size when your Chromium pipeline and downstream PDF workflow support it.
Can CSS create a PDF without JavaScript?
CSS controls layout and print appearance, but a browser PDF engine or another HTML-to-PDF renderer is still needed to produce the PDF file.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Frequently Asked Questions
Can I add several screenshots to one PDF?
Yes. Put each image in its own figure or section and use page-break rules to control whether a new screenshot starts on a fresh page.
Should I use PNG or JPEG?
PNG is usually clearer for interface text and sharp edges; JPEG is smaller for photographic content. WebP can reduce size when your Chromium pipeline and downstream PDF workflow support it.
Can CSS create a PDF without JavaScript?
CSS controls layout and print appearance, but a browser PDF engine or another HTML-to-PDF renderer is still needed to produce the PDF file.
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.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →

