Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Convert a Webpage to a Landscape PDF with Puppeteer

Use `landscape: true` in Puppeteer’s `page.pdf()` options to save a webpage as a landscape PDF, then tune paper size, print styling, and readiness as needed.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set landscape: true in the options passed to Puppeteer’s page.pdf(). The example below navigates to a webpage, then saves a landscape PDF as page.pdf.

Generate a landscape PDF

Install Puppeteer in your Node.js project if it is not already installed. Save this as an ES module file such as make-pdf.mjs, then run it with Node.js:

As an Amazon Associate I earn from qualifying purchases.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();

try {
  const page = await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'networkidle2' });
  await page.pdf({
    path: 'page.pdf',
    landscape: true,
  });
} finally {
  await browser.close();
}

The orientation switch is landscape: true. Puppeteer documents the default as false, which prints in portrait orientation. See the Puppeteer PDFOptions reference and PDF generation guide.

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

Choose paper size and fit

Landscape changes page orientation; it does not guarantee that every webpage will fit legibly. Decide which paper dimensions to use and whether the page’s print CSS should control them.

#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner | For Computers including PC and Mac Receipt and Document Scanner USB Powered
  • 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
  • Named paper: Set format, such as 'A4' or 'Letter'. If you also set width and height, format takes precedence.
  • Explicit dimensions: Use width and height when you need custom dimensions. The API supports CSS units such as inches, millimeters, and pixels.
  • CSS page size: By default, Puppeteer scales content to fit the paper dimensions selected through the API. Set preferCSSPageSize: true when the page’s CSS @page size should take priority.
  • Margins: Margins are unset by default. Specify them when you need whitespace around content or want to prevent it from running to the edge.
  • Scale: The default is 1; the documented range is 0.1 to 2. Change it only when needed to balance fit and readability.

For example, to use landscape A4 with a small margin and include background graphics:

await page.pdf({
  path: 'page.pdf',
  format: 'A4',
  landscape: true,
  margin: { top: '10mm', right: '10mm', bottom: '10mm', left: '10mm' },
  printBackground: true,
});

Control print styles, colors, and backgrounds

page.pdf() renders using the print CSS media type. That can produce a different layout from what you see in a browser window: sites may hide navigation, change typography, or rearrange content for printing. Inspect the page’s print styles and @page rules if the PDF layout is unexpected.

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)

To render with screen media styles instead, emulate screen media before creating the PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.emulateMediaType('screen');
await page.pdf({ path: 'page.pdf', landscape: true });

Background graphics are excluded by default; set printBackground: true if the PDF needs them. Printing can also alter colors. Puppeteer documents using the CSS property -webkit-print-color-adjust to force exact colors, for example in the page’s print stylesheet:

Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • 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
@media print {
  body {
    -webkit-print-color-adjust: exact;
  }
}

Use exact color adjustment selectively: it affects how print colors are rendered, but cannot fix layout problems caused by page dimensions or print CSS. See the Page.pdf() API reference.

Wait for the page to be ready

The sample uses waitUntil: 'networkidle2', an example readiness condition in Puppeteer’s guide—not a guarantee that every site’s client-rendered content is complete. Choose a condition that matches the page. A site may keep network requests open, or render important elements after navigation has completed.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • 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

For a known dynamic element, wait for that element before generating the PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('.report-ready');
await page.pdf({ path: 'page.pdf', landscape: true });

Replace .report-ready with a selector that appears only when the content you need is available. Puppeteer’s PDF guide says font loading is awaited by default. For other late-loading content, use a suitable wait condition or explicit selector wait rather than assuming navigation alone means the page is ready. Navigation behavior and return values are described in the Page.goto() API reference.

Best Value
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

What the PDF call returns

page.pdf() returns a Uint8Array. If you provide path, Puppeteer writes the PDF to that location; without it, you can use the returned bytes in your own storage or response flow:

const pdfBytes = await page.pdf({ landscape: true });

Troubleshoot common problems

  • The PDF is still portrait: Confirm that landscape: true is inside the object passed to page.pdf(), not the navigation options.
  • Content is clipped or too small: Review format, width, height, margins, and any CSS @page rules. Remember that format overrides explicit width and height, and that preferCSSPageSize changes whether CSS page dimensions take priority.
  • The PDF looks unlike the browser view: Puppeteer uses print media by default. Check the site’s print styles, or call page.emulateMediaType('screen') before page.pdf() if screen styling is what you want.
  • Backgrounds are missing: Enable printBackground: true.
  • Colors look washed out or changed: PDF printing modifies colors by default. Use -webkit-print-color-adjust: exact in the page’s CSS when exact print colors are required.
  • Dynamic content is absent: Wait for a meaningful selector or other page-specific readiness condition before calling page.pdf(). A navigation event does not establish that every asynchronously rendered component is ready.
  • Navigation returns null: This is documented for navigation to about:blank and for a navigation to the same URL with only a different hash. It is not itself evidence that PDF generation failed.
  • You are trying to navigate to an existing PDF: Puppeteer’s headless shell does not support navigation to a PDF document. That limitation concerns opening a PDF as the navigation target, not generating one with page.pdf().

Or skip the browser setup

For a hosted capture, ScreenshotNeo can return a PDF from one GET request. Its PDF options include paper size, margins, landscape orientation, and page ranges. The API also offers settings for waiting on a selector, delay, or network idle when a page needs extra time to render.

See the ScreenshotNeo API documentation for the available parameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -d format=pdf -d landscape=true -o page.pdf

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can each be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers indicate the page verdict and billing status. It also has an MCP server with screenshot, page-info, and PDF-capture tools for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan. Learn more at ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.

Frequently Asked Questions

Does `page.pdf()` use print or screen CSS by default?

It uses print CSS by default. Call `page.emulateMediaType(‘screen’)` before `page.pdf()` to render with screen media styles.

Can I set landscape orientation and custom page dimensions together?

Yes. Set `landscape: true` along with `format` or with explicit `width` and `height`. If `format` and dimensions are both present, `format` takes precedence.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
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.

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

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
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.