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.

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

When a PDF link opens a new tab, Puppeteer has not necessarily downloaded anything. Treat the tab as a popup, capture it before clicking, read its final URL, and then choose the correct download path:

  • For an existing PDF URL, download the response directly or handle Chrome’s download events.
  • For HTML that must be rendered as a PDF, use page.pdf({path}).

This distinction avoids relying on the browser’s embedded PDF viewer, which may only display the document.

The reliable popup pattern

Register the popup listener before the click. Starting it afterward creates a race: the new tab can open and emit its event before your code begins waiting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({headless: true});
  const page = await browser.newPage();
  await page.goto('https://example.com/documents', {waitUntil: 'networkidle2'});

  const popupPromise = new Promise((resolve, reject) => {
    const timer = setTimeout(() => reject(new Error('Popup timeout')), 30000);
    page.once('popup', popup => {
      clearTimeout(timer);
      resolve(popup);
    });
  });

  await page.locator('a[href$=".pdf"]').click();
  const pdfPage = await popupPromise;
  await pdfPage.waitForFunction(() => location.href !== 'about:blank');
  console.log('Popup URL:', pdfPage.url());

  await browser.close();
})();

page.once('popup') resolves to a new Page. The initial URL can be about:blank while script navigation is still pending, so wait for it to change. Use a selector matching the actual site; an href$=".pdf" selector is only an example.

#1 Best Overall
Sale
Epson EcoTank ET-2800 Wireless Color All-in-One Supertank Printer - Black
  • INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
  • COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
  • ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
  • HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs

First decide what the popup contains

Existing PDF resource

If the final URL is a PDF endpoint, obtain the bytes with an HTTP request or Chrome’s download lifecycle. Opening the URL in a viewer is not proof that a file was written.

HTML page to print

If the popup contains ordinary HTML and your goal is to create a PDF of that page, call page.pdf({path}) on the page you want to render. Puppeteer’s official guidance is: “For printing PDFs use Page.pdf().” The method renders the current page; it does not fetch an arbitrary PDF URL opened by a link.

Download an already-hosted PDF with the session

A direct request must preserve the browser session when the document is protected. Copy cookies and, when required, authorization or referer headers. Otherwise a URL that looks like a PDF may return a login page or an HTML error.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const fs = require('node:fs/promises');
const https = require('node:https');

async function downloadWithSession(page, url, output) {
  const cookies = await page.cookies();
  const cookieHeader = cookies.map(c => `${c.name}=${c.value}`).join('; ');
  const headers = {
    Cookie: cookieHeader,
    Referer: page.url(),
    Accept: 'application/pdf,*/*'
  };

  const response = await fetch(url, {headers, redirect: 'follow'});
  if (!response.ok) throw new Error(`PDF request failed: ${response.status}`);
  const type = response.headers.get('content-type') || '';
  if (!type.includes('pdf')) {
    throw new Error(`Expected PDF, received ${type || 'unknown content type'}`);
  }
  const bytes = Buffer.from(await response.arrayBuffer());
  await fs.writeFile(output, bytes);
}

// After pdfPage has navigated:
await downloadWithSession(pdfPage, pdfPage.url(), 'document.pdf');

Some applications send a bearer token rather than a cookie. Add the same Authorization value used by the page, and include any required custom headers. Confirm both the HTTP status and content type; a successful status alone can still represent an HTML login form.

Use Chrome DevTools Protocol for browser-managed downloads

When the site triggers a download instead of exposing a stable PDF URL, observe Chrome’s download events. Puppeteer exposes createCDPSession() for this lower-level control.

Rank #2
Sale
Epson EcoTank Photo ET-8550 Wireless Wide-Format All-in-One Tank Printer
  • CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
  • INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
  • PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
  • ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
const client = await page.createCDPSession();
await client.send('Browser.setDownloadBehavior', {
  behavior: 'allow',
  downloadPath: '/absolute/path/downloads'
});

await client.send('Browser.downloadWillBegin', {}); // Enablement depends on your Chrome/Puppeteer version

client.on('Browser.downloadWillBegin', event => {
  console.log('Download started:', event.url, event.suggestedFilename);
});
client.on('Browser.downloadProgress', event => {
  if (event.state === 'completed') console.log('Download completed:', event.guid);
  if (event.state === 'canceled') console.error('Download canceled:', event.guid);
});

The Browser domain reports inProgress, completed, and canceled states. Wait for completed and then verify the resulting file. CDP command availability can vary with the Chrome version bundled with your Puppeteer release; if a command is rejected, use the direct HTTP method instead.

Generate a PDF from the popup’s HTML

If the popup is a report page rather than a PDF resource, print it after navigation and styling are complete.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await pdfPage.waitForNetworkIdle({idleTime: 500, timeout: 30000});
await pdfPage.pdf({
  path: 'report.pdf',
  format: 'A4',
  printBackground: true,
  preferCSSPageSize: true,
  margin: {top: '16mm', right: '16mm', bottom: '16mm', left: '16mm'}
});

page.pdf() waits for fonts by default. It prints the current page, so make sure the popup has finished navigation and any application data has rendered before calling it.

Headless mode and the embedded viewer

Puppeteer’s Page API warns that headless shell mode does not support navigation to a PDF document. Code that expects the viewer tab to behave like a normal HTML page is therefore fragile. Capture the URL and request the resource directly, or use CDP download events in a regular Chrome context. Do not assume that seeing a viewer means a file exists on disk.

Authentication, redirects, and request fidelity

  • Redirects: use the final URL after waiting for navigation; the original link may point to a tracking or authorization endpoint.
  • Cookies: extract cookies from the relevant page or browser context and send them in the direct request.
  • Headers: reproduce authorization, referer, user agent, or tenant headers when the server requires them.
  • Signed URLs: download promptly; expiration can occur between popup navigation and your request.
  • Content validation: check status, content type, and file size. For stronger validation, inspect the first bytes for the PDF signature %PDF-.

Common failures and fixes

Popup timeout

The click may not open a tab, the selector may target the wrong element, or a consent overlay may intercept it. Verify the selector, dismiss overlays, and increase the timeout only after confirming the site is genuinely slow.

Rank #3
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
  • SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
  • INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
  • KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
  • PREMIUM SUPPORT - Strong technical expertise to solve issues faster
  • THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.

about:blank never changes

The site may create a blank tab and navigate it later, or may have blocked the navigation. Wait for the popup, then apply a navigation timeout and inspect console or network errors.

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

The saved file is HTML

Your request probably lacked cookies or authorization. Log the final URL and content type, preserve the browser session, and reject non-PDF responses before writing them.

No file appears after the click

A viewer tab is not a download event. Use direct HTTP retrieval or listen for CDP download progress and wait for completed.

PDF navigation fails in headless shell

Avoid navigating the shell directly to the PDF. Capture the URL and fetch it, or run a supported regular Chrome mode with CDP download handling.

The PDF is missing recent content

Wait for the application’s data or a specific selector, not merely the first navigation event. waitForNetworkIdle can help, but a page with long-lived connections may require an explicit readiness selector.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
NDYIN Portable Printers Wireless for Travel, N80 Bluetooth Thermal Printer
  • Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
  • No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
  • Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
  • Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
  • The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing the method

Situation Recommended method Completion check
New tab points to an existing PDF Direct HTTP request with session headers HTTP success, PDF content type, file signature
Site starts a browser download Chrome DevTools Protocol download events completed state and file check
Popup is HTML you need to render page.pdf({path}) File exists after the promise resolves
Protected or expiring document Direct request immediately after popup URL capture Preserved cookies/authentication and valid bytes

Performance and reliability notes

  • Reuse one browser and context for multiple documents, but isolate users in separate contexts.
  • Set explicit navigation and download timeouts so a stalled origin cannot hold the worker indefinitely.
  • Write to a temporary filename and rename after validation to prevent consumers from reading partial files.
  • Limit concurrent downloads to what the target site and your memory budget can handle.
  • Record the final URL, status, content type, byte count, and completion state for diagnosis.

Or skip the browser setup

For a hosted page that you simply need captured as an image or PDF, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—work with Claude, Cursor, and other MCP clients.

One cURL request is enough for a screenshot or PDF response, depending on the requested options:

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

See the ScreenshotNeo documentation for PDF parameters, paper size, margins, page ranges, authentication, waiting rules, and other options. Python and Node.js equivalents:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.

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.

FAQ

Does clicking a PDF link prove Puppeteer downloaded it?

No. It proves only that navigation or a viewer opened. Verify an HTTP response or a completed download and inspect the resulting file.

Can page.pdf() download a PDF URL?

No. It prints the current HTML page. Fetch an existing PDF resource directly or handle its browser download instead.

Why does the popup URL require my login again?

The direct request did not carry the popup’s cookies or authorization headers. Preserve the session when leaving the browser context.

Quick Recap

Bestseller No. 3
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
PREMIUM SUPPORT - Strong technical expertise to solve issues faster; THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
$189.99

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.