Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use Puppeteer to visit each URL and call page.pdf() with a different output path for every page. Puppeteer provides the navigation and PDF-export functions; the loop and filenames are your application code. The example below processes URLs sequentially and saves one PDF per URL.
Convert a URL list into separate PDFs
Install Puppeteer in a Node.js project if it is not already installed, then save this as an ES module such as convert.mjs. Replace the sample URLs with your own full URLs, including https://. The script writes files named output-1.pdf, output-2.pdf, and so on in the current directory.
As an Amazon Associate I earn from qualifying purchases.
import puppeteer from 'puppeteer';
const urls = [
'https://example.com',
'https://example.org',
];
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
for (const [index, url] of urls.entries()) {
try {
const response = await page.goto(url, { waitUntil: 'networkidle2' });
if (response && !response.ok()) {
throw new Error(`HTTP ${response.status()}`);
}
await page.pdf({
path: `output-${index + 1}.pdf`,
format: 'A4',
});
console.log(`Saved output-${index + 1}.pdf from ${url}`);
} catch (error) {
console.error(`Could not convert ${url}: ${error.message}`);
}
}
} finally {
await browser.close();
}
Install Puppeteer with npm install puppeteer if needed. The per-URL error handling lets later URLs proceed after an individual failure. Remove the inner try/catch if you prefer the whole job to stop on the first error; the outer finally still closes the browser.
What the script does—and what it does not guarantee
Navigation and export
page.goto(url) navigates the tab to a URL, and page.pdf() exports the page currently open in that tab. Puppeteer documents Page.pdf() as generating a PDF with the print CSS media type. The documented API returns a Promise<Uint8Array>; supplying path writes the result to that file. See the Puppeteer Page.pdf() API and the PDF generation guide.
#1 Best Overall
Waiting for pages to load
networkidle2 is a useful navigation wait option shown in Puppeteer’s PDF guide, but it does not guarantee that every site’s asynchronous content, fonts, or lazy-loaded images are ready. If a page has a known readiness signal, wait for that selector or condition before exporting. Avoid relying on an arbitrary sleep when a site-specific condition is available. Page.goto() can reject for invalid URLs, TLS errors, unreachable servers, timeouts, or failed main-resource loads; it can also return null in documented special cases. The Page.goto() API describes navigation behavior and options.
Choose print styling and PDF page settings
Puppeteer’s PDF output uses print media by default. If you need the page’s screen styling instead, call await page.emulateMediaType('screen') before page.pdf(). Printing adjusts colors by default; for exact color rendering, the Puppeteer API points to the CSS property -webkit-print-color-adjust.
Rank #2
Common settings include paper format, dimensions, margins, background printing, page ranges, orientation, scale, and header or footer templates. The options reference documents these settings; format defaults to Letter and takes precedence over width and height. preferCSSPageSize defaults to false, so CSS @page dimensions are otherwise scaled to fit the selected paper. Font waiting is enabled by default through waitForFonts.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute| Need | Setting or action |
|---|---|
| Use A4 or Letter paper | Set format: 'A4' or format: 'Letter'. |
Honor the page’s CSS @page size |
Set preferCSSPageSize: true. |
| Include colored backgrounds | Set printBackground: true. |
| Set page margins | Pass a margin object with top, right, bottom, and left values. |
| Export selected pages | Use pageRanges with the desired page ranges. |
| Match screen layout | Call page.emulateMediaType('screen') before exporting. |
For example, to include background colors and set margins, change the export call to:
await page.pdf({
path: `output-${index + 1}.pdf`,
format: 'A4',
printBackground: true,
margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' },
});
Consult the installed version’s PDFOptions reference for the complete option definitions. The current official references consulted show Puppeteer documentation version 25.12.0; defaults and available options can change, so check the documentation matching your installed version.
Separate PDFs or one combined document?
The loop above creates one PDF for each URL. Use a unique path for each output; reusing the same path would overwrite an earlier file. The official PDF-generation workflow exports the current page, and the reviewed documentation does not describe a built-in multi-URL PDF merge operation. If you need one combined file, generate the PDFs first and merge them as a separate step with a PDF library or tool chosen for your project.
Rank #4
Reliability, throughput, and cost considerations
- Report failures with their URLs. Keeping each URL in the error message makes a failed item identifiable in a long batch.
- Close the browser reliably. The outer
try/finallycloses the browser even if an export fails; Puppeteer’s getting-started example also closes the browser after its work. - Start sequentially. Reusing one page keeps the workflow simple. A browser can hold multiple pages, but parallel capture uses more resources; choose concurrency based on your runtime and target sites rather than assuming a universal safe limit.
- Plan for site-specific readiness. Network-idle is not a guarantee that all dynamic content has settled. Add a targeted wait only when the site requires one.
Each URL triggers a navigation and PDF render, so batch duration depends on the sites and runtime. Puppeteer itself does not provide a special multi-URL export or merge step in this workflow.
Troubleshooting common failures
- Invalid URL or navigation rejection: confirm every entry includes a scheme such as
https://; preserve the full URL in logs. Navigation can also fail because of SSL, reachability, timeout, or main-resource errors. - HTTP error response: the example checks
response.ok()and reports the HTTP status. Decide whether to skip that URL or stop the batch, based on your requirements. - PDF looks different from the browser: PDF uses print CSS by default. Check the site’s print styles, or switch to screen media with
emulateMediaType('screen'). - Background colors are missing: set
printBackground: true. - Content is missing or incomplete:
networkidle2is only a wait condition, not proof that site-specific rendering has finished. Wait for the relevant selector or readiness condition. - Output file was replaced: ensure each URL gets a distinct output path.
- Browser remains running after an error: retain the outer
try/finallyand callbrowser.close()there.
Or skip the browser setup
If you need a screenshot or PDF through an API rather than running the browser yourself, ScreenshotNeo accepts a URL in one GET request. Its screenshot cleanup accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. It also provides an MCP server for AI agents, with tools including take_screenshot and capture_pdf. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000.
For a PDF call, see the ScreenshotNeo documentation for current parameters and response details:
Best Value
- Used Book in Good Condition
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-d format=pdf
-o page.pdf
Sign up for ScreenshotNeo and get 1,000 free screenshots a month with no card.
Frequently Asked Questions
Does Puppeteer have a built-in method to convert an array of URLs into one PDF?
No built-in multi-URL PDF method is documented in the cited workflow. The example loops over URLs and saves an individual PDF for each.
Can I use the same Puppeteer page for every URL?
Yes. The example reuses one page sequentially, navigating to each URL before exporting it.
Quick Recap
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.

