How to Save a Web Page as PDF
Save any webpage as a readable PDF on Windows, Mac, Android, iPhone, or with code. Fix ads, missing images, page breaks, and clutter.
Open the page, choose Print (or Share on mobile), then select Save as PDF. Windows and macOS include PDF printing, Chrome and Firefox expose print-preview controls, Android Chrome uses Share → Print → Save as PDF, and iPhone Safari uses Share or the Page Menu → Markup → Done → Save File To.
For a repeatable developer workflow, use a headless browser or an API. Browser printing is free and convenient for one-off documents; automation gives you predictable page size, margins, waiting, authentication, and batch processing.
Save a webpage as PDF on Windows
- Open the page in Chrome, Firefox, Edge, or another browser.
- Press Ctrl+P, or open the browser menu and choose Print.
- Choose Save as PDF or Microsoft Print to PDF as the destination.
- Set the page range, orientation, paper size, scale, margins, headers, footers, and background graphics.
- Click Print or Save, choose a folder, and name the file.
The Consumer Financial Protection Bureau documents this Ctrl+P workflow and the Microsoft Print to PDF destination.
Save a webpage as PDF on macOS
- Open the webpage in Safari, Chrome, Firefox, or Edge.
- Press Command+P.
- Configure pages, orientation, paper size, scale, margins, and background graphics in the print dialog.
- Open the PDF menu in the lower-left corner and choose Save as PDF.
- Choose a location and click Save.
Save a webpage as PDF in Chrome
On desktop, open the print dialog with Ctrl+P (Windows/Linux) or Command+P (Mac). Select Save to PDF, then adjust:
- Destination
- Pages or a custom page range
- Portrait or landscape orientation
- Paper size
- Margins and scale
- Headers and footers
- Background graphics
Turn on background graphics when colors, charts, or shaded sections disappear from the preview.
Save a webpage as PDF in Firefox
- Open the Firefox menu and select Print.
- Set Destination to Save to PDF.
- Choose the page range, orientation, paper size, scale, margins, headers and footers, and whether to print backgrounds.
- Use Simplified format when Firefox offers it and the page contains distracting navigation or advertising.
- Click Save.
Firefox notes that websites can use different print styles, so the preview may not match the screen exactly.
Save a webpage as PDF in Microsoft Edge
Press Ctrl+P on Windows or Command+P on Mac, or choose Print from the three-dot menu. Edge provides page range, orientation, paper size, margins, scaling, headers and footers, and background-graphics controls. If the preview loses colors or images, enable Background graphics. When supported by the site, Immersive Reader can provide a cleaner version before printing.
Save a webpage as PDF on Android
- Open the page in Chrome.
- Tap More (⋮), then Share.
- Choose Print.
- Open the printer selector and choose Save as PDF.
- Choose a folder, then tap Print or Save.
Save a webpage as PDF on iPhone
- Open the page in Safari.
- Tap the Page Menu or Share button.
- Tap Markup. Add annotations if needed.
- Tap Done, then choose Save File To.
- Name the PDF, select a folder in Files, and tap Save.
Make the PDF clean and readable
Remove ads, navigation, and popups
Try Firefox Simplified format or Edge Immersive Reader when available. Close cookie dialogs, newsletter prompts, chat widgets, and video overlays before opening print preview. If the page has a reader view, use it before printing.
Prevent missing colors and images
Enable background graphics in the print settings. Wait for images, charts, and fonts to finish loading before printing. Lazy-loaded images may not appear until you scroll through the page.
Control page breaks
Use a smaller scale, wider margins, landscape orientation, or a custom page range. For long articles, print preview is the quickest way to find a heading stranded at the bottom of a page or a table split across pages.
Edit content before printing
Firefox documentation names the Print Edit WE extension as one possible editing workflow. Check that an extension supports your browser version and review its permissions and terms before installing it.
Automate webpage-to-PDF conversion
For scheduled reports, CI jobs, or many URLs, a headless browser lets you wait for JavaScript, set authentication, inject CSS, and write the PDF to disk.
Playwright (Node.js)
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage({
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 1
});
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.emulateMedia({ media: 'print' });
await page.pdf({
path: 'page.pdf',
format: 'A4',
printBackground: true,
margin: { top: '16mm', right: '16mm', bottom: '16mm', left: '16mm' }
});
await browser.close();
Install with npm install playwright and download a browser with npx playwright install chromium. Replace networkidle with a selector wait when analytics or long polling prevents the network from becoming idle.
Python with Playwright
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(viewport={"width": 1440, "height": 900})
page.goto("https://example.com", wait_until="networkidle")
page.emulate_media(media="print")
page.pdf(
path="page.pdf",
format="A4",
print_background=True,
margin={"top": "16mm", "right": "16mm", "bottom": "16mm", "left": "16mm"},
)
browser.close()
cURL and HTTP APIs
A screenshot or rendering API can move browser management out of your application. Confirm that the service supports PDF output, then pass the page URL and PDF options such as paper size, margins, orientation, and page ranges.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. Its capture options include PDF paper size, margins, landscape mode, and page ranges, plus waits, custom CSS and JavaScript, cookies, headers, authentication, timezone, geolocation, and full-page loading for lazy images. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. An MCP server lets Claude, Cursor, and other MCP clients call screenshot and PDF tools.
See the ScreenshotNeo API documentation for PDF parameters and the complete option list.
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url=https://example.com \
-o page.pdf
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.pdf", "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(`HTTP ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());
await Bun.write('page.pdf', data);
Use the PDF format option described in the docs when your request must return PDF rather than an image. ScreenshotNeo has 1,000 free shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Ads or cookie banners appear | The page was printed before cleanup or the browser has no reader view. | Dismiss overlays, use Simplified format or Immersive Reader, or hide selectors in an automated capture. |
| Colors or images are missing | Background graphics are disabled or assets are still loading. | Enable background graphics and wait for the page; in automation, wait for a selector or network state. |
| Only the visible viewport is captured | The print or capture workflow did not render the full document. | Use the browser’s print function for the document, or enable full-page capture in automation. |
| Text is cut off | Scale, margins, or orientation do not fit the content. | Reduce scale, increase margins, choose landscape, or select a larger paper size. |
| JavaScript content is absent | Printing started before the application finished rendering. | Wait for a specific element, a deliberate delay, or network idle; avoid relying on a fixed short delay for slow pages. |
| PDF generation times out | The page has slow third-party resources, infinite scrolling, or long polling. | Block unnecessary resource types, wait for a meaningful selector, and set a practical timeout. |
| Authenticated content is blank | The capture request lacks session cookies or authorization headers. | Provide cookies, custom headers, or an Authorization header through your automation or API. |
Performance, reliability, and cost
- One-off saves: Browser print is free and requires no service account.
- Repeatability: Pin paper size, margins, scale, browser version, and print background settings in automation.
- Speed: Reuse a browser process, block ads and trackers, and wait for the page element you need instead of an unnecessarily long global delay.
- Reliability: Retry transient navigation failures, record the final URL and response status, and keep the source URL with the generated file.
- Cost control: Cache unchanged pages and avoid recapturing identical URLs. ScreenshotNeo charges only for clean captures; failed loads, bot checks, blank pages, timeouts, and cache hits are free.
Checklist before sharing a PDF
- Confirm the title, URL, and capture date are present if readers need provenance.
- Check the first, middle, and final pages for clipped text.
- Verify images, colors, tables, and code blocks.
- Remove cookie dialogs, ads, navigation, and chat overlays.
- Open the saved file in a second PDF viewer.
- For sensitive pages, confirm that credentials and private data are not visible.
FAQ
Can I save a webpage as PDF without installing software?
Yes. Print-to-PDF is built into Windows and macOS, Chrome and Firefox desktop, Android Chrome, and iPhone Safari’s share workflow.
Why does my PDF look different from the webpage?
Websites often use separate print styles. Print preview may remove navigation, change fonts, reflow columns, or omit backgrounds.
How do I save only part of a webpage?
Select a page range in print preview. For an element or section that does not align with pages, use a browser automation tool or an API that can capture a CSS selector.
Can a PDF include content loaded after the initial page load?
Yes, if the workflow waits for that content. Prefer a selector or application-ready signal over an arbitrary delay.
Is browser print better than an API?
Browser print is simplest for occasional local files. An API is more practical for scheduled, authenticated, customized, or bulk PDF generation.


