ScreenshotNeo

BlogHow-to

How to Download a Document From a Website

Save a website document to your computer or phone, find it afterward, handle PDF previews, and fix blocked or failed downloads.

By the ScreenshotNeo team1 October 20267 min read

To download a document from a website, open the page, select its download link or button, choose where to save the file if prompted, then check your browser’s Downloads list. If the document opens in a browser tab, use the PDF viewer’s download or save control. On a computer, you can often right-click a PDF link and choose Save Link As. Browser menus and behavior vary by device and version.

Download a document in four steps

  1. Open the intended website. Navigate to the page that hosts the document. Confirm the domain and that the file is expected before opening it.
  2. Find the document link. Look for labels such as Download, PDF, DOCX, Export, or the document’s filename. A normal file link usually starts the download when selected.
  3. Save the file. If the browser asks for a location, choose a folder and confirm. If no prompt appears, the browser usually saves to its configured Downloads folder.
  4. Locate and open it. Open the browser’s Downloads panel or list, select the file, and open it with an appropriate viewer. Keep the original file if you need to verify it later.

When a PDF opens in a browser tab

A PDF opening in a tab may be a preview rather than a failed download. Use the viewer’s download icon or save command. In Chrome on a computer, you can also right-click the PDF link and choose Save Link As. Chrome settings can control whether PDFs open in Chrome or download instead; Firefox lets you change the action associated with a file type. See Chrome’s download help and Firefox’s download troubleshooting for current controls.

Save a PDF without opening it

  1. Find the direct PDF link on the page.
  2. Right-click it (or use the device’s link menu).
  3. Choose Save Link As, Download Linked File, or the equivalent command.
  4. Choose a folder and confirm the filename.

Where the downloaded file goes

If you did not choose a folder, check the browser’s Downloads list first. It normally shows the filename, status, and an option to reveal the file in the operating system’s file manager.

Browser or device What to check
Chrome on computer Open the Downloads list and review the configured download location. Chrome can be set to ask where to save each file.
Firefox Open the Downloads panel. File-type settings determine whether a PDF opens, downloads, or asks what to do.
Edge Open Settings > Downloads to see or change the save location.
Safari on Mac Check Safari settings for the download location. If the location changed or the file was moved, Safari may not find it at the previous path.
Phone or tablet Use the browser’s download control, then check the device’s Files, Downloads, or equivalent app. Menu names differ by operating system.

Downloading documents with a command line

For a public direct file URL, command-line tools can save the response without opening a browser. These examples download a PDF named document.pdf.

cURL

curl -L "https://example.com/document.pdf" -o document.pdf

-L follows redirects. Add authentication headers only when the site explicitly provides them, and do not put secrets in shell history.

Python

import requests

url = "https://example.com/document.pdf"
with requests.get(url, stream=True, timeout=60) as response:
    response.raise_for_status()
    with open("document.pdf", "wb") as file:
        for chunk in response.iter_content(chunk_size=1024 * 1024):
            if chunk:
                file.write(chunk)

Node.js

const fs = require('node:fs');

const response = await fetch('https://example.com/document.pdf', {
  redirect: 'follow'
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync('document.pdf', buffer);

These commands work for a direct file response. A page that requires login, a button click, JavaScript, or a short-lived session URL may need an authenticated browser session or the site’s official export endpoint.

  • Login required: Sign in through the intended website and use its download control. Do not copy session cookies into scripts unless you understand their security implications.
  • JavaScript-generated download: Wait for the page to finish loading, then activate the site’s export or download button. Browser automation may be required for repeatable workflows.
  • Temporary link: Download it promptly. A signed URL can expire, so request a fresh link if it returns an authorization error.
  • Embedded viewer: Look for the viewer’s download control or the site’s original-file link. Printing the page to PDF creates a new file and may not preserve the original document.
  • Access restrictions: Respect the owner’s permissions, rate limits, and terms. Do not attempt to bypass authentication or security controls.

Security checks before opening a file

Use the intended, trusted website and treat browser warnings seriously. Chrome warnings can indicate malware, deceptive software, unfamiliar files, or insecure delivery. Do not routinely disable download protection to force a file through. If the filename, extension, or source is unexpected, stop and verify it with the site owner.

Troubleshooting downloads

Symptom Likely cause What to do
The PDF opened in a tab The browser is previewing PDFs Use the viewer’s download icon, or save the link directly. Review the browser’s PDF action setting.
The file downloaded but cannot be found It was saved to the default folder or another selected location Open the Downloads list, reveal the file, and check the browser’s configured path.
The download is blocked The browser detected a dangerous, suspicious, unverified, or insecure file Confirm the domain and expected file with the source. Do not bypass the warning as a first step.
The download fails or stops Connection trouble, an expired link, server failure, or browser-specific issue Reload the source page, request a fresh link, check connectivity, and consult the browser’s download troubleshooting guide. Try another browser only as a diagnostic.
The saved PDF will not open Incomplete, corrupted, or unsupported file Download it again, confirm the file size and extension, try a PDF viewer, and ask the document’s source to confirm that the file is complete and safe.
The script receives HTML instead of a document The URL points to a web page, login redirect, or error page Inspect the final URL and response headers, authenticate through the approved flow, and use the site’s direct export or file URL.
The script returns 403 or 429 Permission failure or rate limiting Use authorized credentials, slow requests, honor retry guidance, and contact the site owner if access should be allowed.

Or skip the browser setup

If your goal is to capture a document page or web page as an image or PDF rather than retrieve the original file, ScreenshotNeo provides a one-request screenshot API. Its capture can accept consent banners before the shot and remove more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. It also offers an MCP server for AI agents, including Claude and Cursor.

See the ScreenshotNeo API documentation for options such as full-page capture, PDF output, custom CSS and JavaScript, waiting for selectors or network idle, headers and cookies, device presets, and signed links.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/document.pdf -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://example.com/document.pdf"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/document.pdf' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Performance, reliability, and cost considerations

  • For one file, the browser is usually the simplest and cheapest option.
  • For repeated downloads, prefer the publisher’s stable export endpoint and record filenames, status codes, and checksums.
  • Large files need sufficient disk space and a stable connection. Stream them in scripts instead of loading the entire response into memory.
  • Retry temporary network failures with increasing delays, but do not repeatedly retry authentication failures or rate limits without following the site’s guidance.
  • A screenshot or rendered PDF is a new representation of a page; it is not a substitute for the original downloadable document when fidelity, metadata, accessibility, or embedded attachments matter.

FAQ

Does opening a document download it?

Not necessarily. A browser tab may show a preview. Use the viewer’s download control or save the link.

How do I download a document on a phone?

Tap the site’s download control, then find the file in the browser’s Downloads area or the device’s Files app. Exact labels depend on the browser and operating system.

Why did the website download an HTML file?

The link may lead to a login page, error page, or application route instead of the document. Sign in through the site and obtain its direct export or file URL.

Can I download a protected document?

Only when the site grants you access. Use its normal sign-in and download workflow; do not bypass permissions or security controls.