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.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To turn several web pages into one PDF with Puppeteer, put the URLs in the order you want, render each page to its own PDF, then merge those files in that same order. Puppeteer’s documented page.pdf() call renders one page at a time; the URL loop and merge are a workflow built around that capability, not a documented one-call multi-URL feature.

How the multi-URL workflow works

A browser prints the page it has loaded. In Puppeteer, you navigate to a URL and call page.pdf() to save that page as a PDF. To produce one file from several pages, organize the job into three stages:

  1. Choose the final order. Put the URLs in a JavaScript array in the order their pages should appear.
  2. Render each URL. Reuse a browser page to navigate to each address and save a separate PDF.
  3. Merge the PDFs. Combine the resulting files in array order using a PDF merger available in your environment.

The first two stages use Puppeteer’s documented navigation-and-render approach. Iterating over a list and merging the outputs is practical workflow guidance; Puppeteer’s cited documentation does not describe a built-in operation that takes several URLs and returns one combined PDF.

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

Render each URL with Puppeteer

Install Puppeteer in a Node.js project using its official setup instructions, then save the following as render-pages.js. This script accepts URLs as command-line arguments, visits them sequentially, and writes one numbered PDF per URL into a rendered-pages directory. The names preserve the input order for the merge step.

#1 Best Overall
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
  • Create a mix using audio, music and voice tracks and recordings.
  • Customize your tracks with amazing effects and helpful editing tools.
  • Use tools like the Beat Maker and Midi Creator.
  • Work efficiently by using Bookmarks and tools like Effect Chain, which allow you to apply multiple effects at a time
  • Use one of the many other NCH multimedia applications that are integrated with MixPad.
const fs = require('node:fs/promises');
const path = require('node:path');
const puppeteer = require('puppeteer');

async function main() {
  const urls = process.argv.slice(2);
  if (urls.length === 0) {
    throw new Error('Pass one or more URLs, in the desired PDF order.');
  }

  for (const url of urls) {
    let parsed;
    try {
      parsed = new URL(url);
    } catch {
      throw new Error(`Invalid URL: ${url}`);
    }
    if (!['http:', 'https:'].includes(parsed.protocol)) {
      throw new Error(`Only http and https URLs are supported: ${url}`);
    }
  }

  const outputDir = path.resolve('rendered-pages');
  await fs.mkdir(outputDir, { recursive: true });

  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    for (let i = 0; i < urls.length; i++) {
      const url = urls[i];
      const response = await page.goto(url, {
        waitUntil: 'networkidle2',
        timeout: 60000,
      });
      if (!response) {
        throw new Error(`No navigation response for ${url}`);
      }
      if (!response.ok()) {
        throw new Error(`HTTP ${response.status()} while loading ${url}`);
      }

      const filename = `${String(i + 1).padStart(3, '0')}.pdf`;
      const outputPath = path.join(outputDir, filename);
      await page.pdf({ path: outputPath, format: 'A4', printBackground: true });
      console.log(`${url} -> ${outputPath}`);
    }
  } finally {
    await browser.close();
  }
}

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

Run it with URLs in the required order:

node render-pages.js 
  https://example.com/first 
  https://example.com/second 
  https://example.com/third

The expected output is rendered-pages/001.pdf, 002.pdf, and 003.pdf. Merge those files in numerical order with a PDF-merging tool that you have installed or are permitted to use; the result is the single deliverable. The merge operation is separate from Puppeteer’s page rendering.

What this script checks—and what it does not

  • It validates that each argument parses as an HTTP or HTTPS URL before launching the browser.
  • It stops if navigation has no response or returns a non-success HTTP status, rather than silently treating that page as a successful capture.
  • It does not authenticate to sites, solve bot checks, choose a page-specific wait condition, or guarantee that a site’s content is complete after the navigation event. Add appropriate handling for sites that require those steps.
  • It writes intermediate PDFs before the final merge. If a page fails, fix the cause and rerun; do not merge a partial set unless that is intentional.

Control print styling and page appearance

page.pdf() uses the print CSS media type. That means a site’s print stylesheet can hide navigation, rearrange columns, or change colors compared with its normal screen view. Puppeteer’s API reference says to emulate screen media before generating the PDF when screen styling is what you want:

await page.emulateMediaType('screen');
await page.pdf({ path: outputPath, format: 'A4', printBackground: true });

Place these lines after navigation and before the PDF call. Screen media may preserve the on-screen design, but it is not necessarily the best layout for paper-sized pages; inspect a sample before running a large batch.

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

Print output may modify colors by default. Puppeteer’s API reference points to the CSS property -webkit-print-color-adjust when exact colors are required. If you control the page’s CSS, for example:

html {
  -webkit-print-color-adjust: exact;
}

That setting affects print color handling; it does not guarantee that every element will fit the page or that the page will break where you prefer. For pages you control, use print-specific CSS such as @media print and page-break rules, then verify the rendered PDF.

Fonts, backgrounds, and readiness

  • Puppeteer’s PDF guide says page.pdf() waits for fonts to load by default. If a font still looks wrong, check whether the page can access it and whether its own loading scripts finish successfully.
  • Use printBackground: true when background graphics and colors should be included. Without it, printed output may omit backgrounds.
  • The sample uses waitUntil: 'networkidle2', matching Puppeteer’s documented example. Some sites keep network connections open or load content later, so this event is not a universal guarantee that every dynamic component is ready.
  • For a site with a known readiness signal, wait for a selector that appears when the needed content is available before calling page.pdf(). Avoid adding an arbitrary delay unless the site’s behavior requires it.

Merge and verify the final document

Once all pages have rendered, merge 001.pdf, 002.pdf, and so on, in ascending numeric order. Use a PDF merger suited to your operating system or application environment; no particular merger or its interface is established here. The important operational requirement is that the merger receives the files in the intended sequence.

  • Open the combined PDF and confirm its page sequence begins with the first URL and ends with the last.
  • Check a page near each source boundary. A missing output, a page with an error message, or a wrongly ordered file can be less obvious in a large combined document.
  • Inspect page size, orientation, clipping, image quality, colors, and page breaks. Rendering each site successfully does not mean their layouts will be consistent with one another.
  • Keep the intermediate PDFs until the merged file has been checked. They make it easier to identify which source page needs to be rerendered.

Choose an approach for your use case

The right workflow depends on whether you need repeatability and control or just an occasional export. The available documented example supports Puppeteer automation; it does not establish a comparison of specific desktop or no-code alternatives.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Need Practical choice What to account for
Repeatable capture from a URL list Puppeteer, followed by a PDF merge step You control order and rendering settings, but must maintain the script and merger workflow.
Occasional capture without scripting A browser or desktop workflow you already use Confirm how it handles multiple pages, order, and whether it creates one combined file; those behaviors vary and are not established here.
Programmatic capture without managing a local browser A screenshot or PDF API Check whether it renders one URL per request or supports a multi-document operation, and plan a merge step if it only returns individual files.

Troubleshooting Puppeteer PDF jobs

The script times out before printing

page.goto() has a 60-second timeout in the example. A slow or continuously active site may not reach the selected navigation condition in time. Check that the URL loads in a browser, then choose a readiness condition appropriate to that site or wait for a specific selector. Increasing a timeout only helps when the page is genuinely slow; it does not fix a page that never reaches the requested condition.

The PDF is blank or lacks late-loaded content

The page may have returned before the content you need appeared, or the site may display a bot check or error instead of the intended page. Inspect the page state after navigation and wait for a meaningful content selector when possible. The sample’s successful HTTP response check does not prove that the response contains the expected article or application view.

Rank #4
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
  • Transform audio playing via your speakers and headphones
  • Improve sound quality by adjusting it with effects
  • Take control over the sound playing through audio hardware

The result looks different from the browser

PDF generation uses print media. Try page.emulateMediaType('screen') before page.pdf() if the on-screen appearance is the goal. If the issue is missing color or background, check print-color CSS and printBackground. Screen styling, exact color handling, and page dimensions are separate concerns.

The files are merged in the wrong order

Keep the input URL order explicit and merge the numbered outputs in ascending order. Do not rely on an operating system’s unspecified directory listing order or filenames that sort alphabetically in an unintended way.

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

One URL fails but earlier PDFs remain

The script writes each PDF as it finishes, so a later failure can leave a partial output directory. Read the logged URL and error, address that page, then rerun or regenerate the failed output. Before merging, confirm that every expected number is present and corresponds to the intended source.

Best Value
WavePad Audio Editing Software - Professional Audio and Music Editor for Anyone [Download]
  • Full-featured professional audio and music editor that lets you record and edit music, voice and other audio recordings
  • Add effects like echo, amplification, noise reduction, normalize, equalizer, envelope, reverb, echo, reverse and more
  • Supports all popular audio formats including, wav, mp3, vox, gsm, wma, real audio, au, aif, flac, ogg and more
  • Sound editing functions include cut, copy, paste, delete, insert, silence, auto-trim and more
  • Integrated VST plugin support gives professionals access to thousands of additional tools and effects
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 from one GET request. It returns a capture for one URL per request, so for a combined document you still need to request each page and merge the resulting PDFs in your chosen order; the one-call endpoint is not a multi-URL-to-single-PDF merger. Here is the cURL form for one page (replace the URL for each request):

curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://stripe.com 
  -o shot.pdf

See the ScreenshotNeo documentation for request options and response details. Its clean-shot workflow accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, 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, and response headers say which page verdict and billing outcome applied. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up free for 1,000 screenshots a month with no card.

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

Sources

Frequently Asked Questions

Does Puppeteer have a single method that accepts several URLs and saves one combined PDF?

The documented page.pdf() method renders the currently loaded page. A multi-URL file requires a workflow that renders the pages and merges their PDFs.

Does Puppeteer wait for fonts before saving a PDF?

Puppeteer’s PDF guide says page.pdf() waits for fonts to load by default.

Quick Recap

Bestseller No. 1
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
Create a mix using audio, music and voice tracks and recordings.; Customize your tracks with amazing effects and helpful editing tools.
Bestseller No. 4
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
DeskFX Free Audio Effects & Audio Enhancer Software [PC Download]
Transform audio playing via your speakers and headphones; Improve sound quality by adjusting it with effects

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.