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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To generate PDFs from a list of product-page URLs, use a browser automation tool such as Playwright or Puppeteer to open each page and save it as a separate PDF. The PDF method handles one open page at a time; your script supplies the batch loop, filenames and error handling.

What you need to decide first

Before converting pages, prepare a plain-text URL list and decide what each output file should be called. For product comparisons, filenames based on a product name or URL slug are easier to recognize than generic names such as page-1.pdf. Sanitize names for filesystem use and account for duplicate product names.

  • Choose whether each PDF should use the site’s print layout or its on-screen layout.
  • Set a paper size, margins and orientation appropriate to how the PDF will be read.
  • Decide how long to wait for page content, especially if product details load dynamically.
  • Keep a record of URLs that fail or produce incomplete output so they can be checked and retried.

Generate PDFs in a batch with Playwright

Playwright’s Page API provides page.pdf() for the current page. The documentation says that “page.pdf() generates a pdf of the page with print css media.” Its API does not itself convert a list: the script below reads URLs, navigates to each one and writes one PDF per page.

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

Install Playwright

This example uses Node.js and Playwright. In a new project, install the package 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

Save the URLs, one per line, in urls.txt. Then save this script as make-pdfs.js:

const fs = require('node:fs/promises');
const path = require('node:path');
const { chromium } = require('playwright');

function filenameFor(url, index) {
  const parsed = new URL(url);
  const slug = parsed.pathname
    .split('/')
    .filter(Boolean)
    .pop() || parsed.hostname;
  const safe = slug.replace(/[^a-z0-9_-]+/gi, '-').replace(/^-+|-+$/g, '');
  return `${String(index + 1).padStart(3, '0')}-${safe || 'product'}.pdf`;
}

async function main() {
  const urls = (await fs.readFile('urls.txt', 'utf8'))
    .split(/r?n/)
    .map(line => line.trim())
    .filter(line => line && !line.startsWith('#'));
  const outputDir = 'pdfs';
  await fs.mkdir(outputDir, { 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];
      try {
        const response = await page.goto(url, {
          waitUntil: 'domcontentloaded',
          timeout: 45000
        });
        if (!response || !response.ok()) {
          throw new Error(`Navigation returned ${response ? response.status() : 'no response'}`);
        }
        // Add a site-specific wait here if important product data loads after navigation.
        await page.pdf({
          path: path.join(outputDir, filenameFor(url, i)),
          format: 'A4',
          printBackground: true,
          margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' }
        });
        console.log(`Saved ${url}`);
      } catch (error) {
        failures.push({ url, error: error.message });
        console.error(`Failed ${url}: ${error.message}`);
      }
    }
  } finally {
    await browser.close();
  }
  await fs.writeFile('failures.json', JSON.stringify(failures, null, 2));
  console.log(`Finished: ${urls.length - failures.length} saved, ${failures.length} failed.`);
}

main().catch(error => {
  console.error(error);
  process.exitCode = 1;
});

Run it with node make-pdfs.js. PDFs are written to pdfs/; failed navigations or exports are listed in failures.json. This is a sequential example, which keeps resource use straightforward. If processing a large list, consider a limited number of workers rather than opening every page simultaneously.

Choose print or screen styling

By default, Playwright generates output using print CSS. That is usually the right choice for a document intended for printing or conventional reading: many sites hide navigation and adjust layout in their print stylesheet. To capture the screen layout instead, emulate screen media before generating the PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'product.pdf', printBackground: true });

Check the resulting PDF: a site’s screen layout may be wider than the selected paper, while its print layout may omit interactive details or arrange content differently.

Useful PDF options

Playwright documents controls for paper dimensions and format, margins, landscape orientation, scale, page ranges, print backgrounds, headers and footers, CSS page-size preference, outline and tagged output. For example, to use a custom paper size or a page range:

await page.pdf({
  path: 'product.pdf',
  width: '210mm',
  height: '297mm',
  margin: { top: '10mm', right: '10mm', bottom: '10mm', left: '10mm' },
  landscape: false,
  scale: 1,
  pageRanges: '1-4',
  printBackground: true
});

Use format or explicit width and height to select the page dimensions. The documented default format is Letter; choose a format deliberately when your intended reader expects A4 or another size. Use page ranges to limit output when a long page includes content you do not need. For the complete supported option definitions and interactions, refer to the Playwright Page API documentation.

Rank #3
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.

Use Puppeteer if it fits your existing stack

Puppeteer also exposes page-level PDF generation. Its Page.pdf() documentation describes print media as the default and provides a screen-media alternative. If your project already uses Puppeteer, the same batch design applies: read URLs, open each page, call page.pdf() and handle each failure. The cited documentation establishes the relevant output behavior, not a performance advantage over Playwright; choose based on your existing browser automation and the controls your project needs.

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

What to expect from product pages

A PDF captures a rendered browser page, not a guaranteed, universal representation of a store’s product record. Product options, prices, availability, reviews and other content may depend on the page’s state or load after the initial navigation. Some sites may also restrict automated access. The documented PDF controls do not establish how any particular merchant handles those conditions, so inspect sample output before relying on a batch for archiving or comparison.

For a product page that fills in after the initial document loads, wait for a stable, page-specific selector before calling page.pdf(), or add a short delay if no reliable selector is available. Avoid treating a successful PDF write as proof that the page contains all expected information.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common batch failures

Navigation times out

A page may be slow, stalled, or waiting on resources that are not necessary for the PDF. The example waits for domcontentloaded rather than waiting for every network request to finish and allows 45 seconds for navigation. Increase the timeout only for pages that need it; if product content loads later, wait for the relevant selector after navigation.

The PDF is blank or missing product details

Confirm that the page loaded the expected product and that any delayed content appeared before export. A navigation response alone does not verify the page’s contents. Add a site-specific selector check, then inspect a few resulting PDFs. If the site relies on screen styling, use page.emulateMedia({ media: 'screen' }).

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

Background colors or images are absent

Enable printBackground: true. Print styles may still intentionally remove backgrounds or alter elements; inspect the rendered PDF and the site’s print CSS behavior.

Best Value
HP LaserJet M110w | Monochrome | Laser Printer
  • FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
  • WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
  • FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
  • WIRELESS WITH SELF-RESET – Helps you stay connected
  • PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more

Output is clipped or split awkwardly

Try the intended paper size, margins, orientation or scale, and compare print media with screen media. A long product page may span many PDF pages. Use a page range only when you intentionally want to omit parts of the capture.

One bad URL stops the whole job

Keep navigation and export inside a per-URL try/catch, as in the example. The script records the URL and error in failures.json, allowing you to correct or retry failures without losing PDFs already created.

Or skip the browser setup

ScreenshotNeo can return a PDF for a URL with one request; its API also supports bulk capture of up to 100 URLs per call. Use the ScreenshotNeo API documentation for PDF options and request details. For a single URL, this cURL call saves a PDF response:

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

ScreenshotNeo accepts and removes known cookie-consent banners, newsletter popups and chat widgets before capture, and those steps can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits cost nothing; response headers identify the page verdict and billing status. Its MCP server provides screenshot and PDF tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.

Frequently Asked Questions

Does Playwright turn a whole URL list into PDFs by itself?

No. page.pdf() exports the current page; your script loops through the URLs and chooses filenames and failure handling.

Does Puppeteer use print styling for PDF output?

Yes. Its documentation says PDF generation uses print media by default and describes an option for screen media.

Quick Recap

Bestseller No. 3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
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.; PAPER CAPACITY: Up to 150 sheets.; SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
$134.99
Bestseller No. 5
HP LaserJet M110w | Monochrome | Laser Printer
HP LaserJet M110w | Monochrome | Laser Printer
WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere; FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided

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.

Free tools Windows power users keep installed

One-click scans. No signup required.

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