Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

Generate Product-Page PDFs from a List of URLs

A practical Playwright workflow for saving product pages from a URL list as separate PDFs, with print settings and guidance for handling failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a browser automation script to open each product URL and save the rendered page as its own PDF. Playwright’s page.pdf() exports the current page; your script supplies the batch loop, filenames, waits, and failure handling. The example below uses Node.js and Playwright.

What the workflow does

A PDF captures a browser-rendered page, not simply the product’s source HTML. Playwright’s Page API documentation states that page.pdf() generates a PDF using print CSS media by default. You can instead emulate screen media before export when you want the screen layout.

As an Amazon Associate I earn from qualifying purchases.

The PDF method operates on the current page. To process a list, your own script must navigate to each URL and save a separate file. Decide in advance how filenames are formed, which page state you need, and what to do when a page fails to load.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Generate one PDF per URL with Playwright

1. Install Playwright

In a new project directory, install Playwright and its Chromium browser:

#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)
npm init -y
npm install playwright
npx playwright install chromium

2. Create the URL list

Save one product-page URL per line in urls.txt. For example:

https://store.example/products/item-one
https://store.example/products/item-two

Use URLs you are permitted to access. Some stores may require a sign-in, block automated browsing, or show different content depending on location, cookies, or interaction.

3. Save this batch script

Create capture-products.mjs. It reads the list, derives safe filenames, visits pages one at a time, writes a PDF per successful page, and logs failed URLs to a separate file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { chromium } from 'playwright';
import { readFile, mkdir, writeFile } from 'node:fs/promises';
import path from 'node:path';

const urls = (await readFile('urls.txt', 'utf8'))
  .split(/r?n/)
  .map(line => line.trim())
  .filter(Boolean);

await mkdir('pdfs', { recursive: true });
const browser = await chromium.launch({ headless: true });
const failures = [];

try {
  const page = await browser.newPage();

  for (let i = 0; i < urls.length; i++) {
    const url = urls[i];
    const filename = `${String(i + 1).padStart(3, '0')}.pdf`;
    try {
      const response = await page.goto(url, {
        waitUntil: 'domcontentloaded',
        timeout: 60000
      });

      if (!response || !response.ok()) {
        throw new Error(`Navigation returned ${response?.status() ?? 'no response'}`);
      }

      // Allow client-rendered product details to settle. Increase or replace
      // this with a selector wait when the store has a reliable product selector.
      await page.waitForTimeout(1500);

      await page.pdf({
        path: path.join('pdfs', filename),
        format: 'A4',
        printBackground: true,
        margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' }
      });
      console.log(`Saved ${filename}: ${url}`);
    } catch (error) {
      failures.push(`${url}t${error.message}`);
      console.error(`Failed: ${url} — ${error.message}`);
    }
  }
} finally {
  await browser.close();
}

if (failures.length) {
  await writeFile('failures.txt', `${failures.join('n')}n`);
  process.exitCode = 1;
}

4. Run the batch

node capture-products.mjs

Successful files appear in pdfs/, numbered in the same order as urls.txt. Failed URLs and error messages are written to failures.txt; correct the cause and rerun those pages. The script uses one browser page sequentially, which keeps the example straightforward and avoids opening a large number of pages at once.

Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Choose the rendering and page settings

Print layout or screen layout

By default, Playwright’s PDF output uses print CSS. A store may use print styles that hide navigation, change typography, or omit content. If the screen layout is preferable, call await page.emulateMedia({ media: 'screen' }) after navigation and before page.pdf(). Puppeteer documents the same print-media default and a screen-media alternative in its Page.pdf() method documentation.

Paper, margins, and orientation

The example selects A4 and 12 mm margins. Playwright otherwise documents Letter as the default format. Set format to a supported paper size, or specify dimensions with width and height. Use landscape: true for wide product tables or layouts. Choose settings for the person who will read or print the file; there is no single layout that fits every product page.

Backgrounds, scale, and page ranges

Use printBackground: true when colors or background images carry useful information. Adjust scale if content is too large or small, and use pageRanges when only selected pages are needed. Check the resulting PDF: scale and page-range choices can omit or shrink content.

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

Headers, footers, and CSS page size

Playwright supports PDF options for headers and footers, including templates, and a setting to prefer page sizing declared in CSS. Enable these deliberately: templates and page CSS can affect the available content area and pagination. Consult the Playwright API reference for the current option names and accepted values.

Rank #3
Sale
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.

Dynamic content and image loading

domcontentloaded confirms that the initial document was parsed; it does not guarantee that every client-rendered price, image, or option has appeared. The example adds a short wait only as a basic fallback. For a store with stable markup, replace it with a wait for a product title, price, or other selector that signals the required content is present. If images load lazily as the page scrolls, inspect whether the PDF includes them; a page may need to be scrolled before capture, and no one wait strategy guarantees complete rendering across stores.

Batch reliability and practical limits

  • Use meaningful filenames. Numbered names avoid collisions. If using product names or URL slugs instead, sanitize characters that are invalid in filenames and account for duplicate names.
  • Record failures rather than silently skipping them. The script writes failed URLs and navigation errors to failures.txt. Review the output PDFs as well; a successful navigation does not prove that the product details are complete.
  • Start sequentially. Processing one page at a time is easier on the local machine and the destination site than launching many pages in parallel. The cited documentation provides no performance benchmark for either approach.
  • Expect differences between sites. Browser export controls do not establish how every merchant handles automation, access restrictions, dynamic content, or interactive state. Check documents against their intended use rather than assuming identical results for all pages.
  • Keep the browser environment maintained. Playwright depends on its browser runtime; install the browser version required by the Playwright package and rerun installation after dependency changes if the executable is missing.

When Playwright MCP is a better fit

If an AI-agent workflow is already using Playwright MCP, its PDF Export capability can save the current page rather than requiring a separate Node batch script. The Playwright MCP PDF Export documentation describes archiving web pages and creating documentation as use cases, and specifies that PDF generation is Chromium-only. A list still needs orchestration to visit each URL and save each result.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo can return a PDF for a URL through a single GET request. For a list, call it once per URL and save each response as a distinct PDF. Its documented endpoint and options are in the ScreenshotNeo API documentation.

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://stripe.com 
  -d format=pdf 
  -o product.pdf

For a batch, repeat the request for each line in your URL list and choose a unique output filename. Confirm the PDF format parameter and other available options in the API documentation before adapting this request to your workflow.

Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
  • Cookie and consent banners are accepted like a visitor and removed, along with known 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 are not billed; response headers report the page verdict and billing status.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI-agent clients.
  • The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo free: 1,000 screenshots a month, no card required.

Frequently Asked Questions

Does Playwright’s PDF method convert a list of URLs by itself?

No. It exports the current page. Your script must loop over URLs and manage navigation, filenames, and failures.

Can I use Puppeteer instead of Playwright?

Yes. Puppeteer also documents page-level PDF generation with print media as the default and an option to emulate screen media. Choose based on your existing browser automation environment and integration needs.

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

Will each PDF exactly match what I see on every store page?

That is not guaranteed. Merchant access controls, dynamic content, page state, and print styling can change what the browser renders, so inspect the PDFs you intend to rely on.

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.

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
PC Slower Than It Used to Be?Free scan - under a minute
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.