ScreenshotNeo

BlogHTML to image & PDF

How to Capture a Full-Page PDF of a Website with Browshot

Browshot documents full-page PNG screenshots with size=page, but its reviewed docs do not explain PDF export. Here’s the capture workflow and what remains unresolved.

By the ScreenshotNeo team4 October 20269 min read

Short answer: Browshot documents full-page screenshots with size=page. Its reviewed official documentation describes screenshot image output, including PNG, and says full-page captures can reach up to 15,000 pixels tall. It does not document direct PDF export or a supported image-to-PDF procedure. So you can capture the full page with Browshot, but the PDF-generation step remains unresolved in the documentation reviewed for this guide.

This distinction matters: size=page controls the screenshot dimensions; it is not a PDF option. The examples below save a PNG image. They do not claim to convert it into a PDF.

1. Capture a full-page screenshot with Browshot

Browshot’s simple API can return the screenshot through one URL. Set size=page, supply your API key and target URL, and follow redirects. The API’s simple endpoint may return HTTP 302 while the capture is processing; Browshot’s command-line guide uses curl’s -L option to follow that redirect.

curl -L --fail --show-error \
  --get 'https://api.browshot.com/api/v1/simple' \
  --data-urlencode 'url=https://example.com/' \
  --data-urlencode 'key=YOUR_BROWSHOT_API_KEY' \
  --data-urlencode 'size=page' \
  --output website.png

Replace the placeholder key with the key from your Browshot account. The successful simple-API response body is a PNG screenshot. Check the saved file’s type before using it downstream; naming a file .pdf does not turn image bytes into a PDF.

2. Choose the capture settings

The most relevant documented settings for a long page are:

Setting Documented behavior When to use it
size screen is the default; page requests a full-page screenshot. Use page for the complete page, rather than only the visible browser viewport.
screen_width Desktop viewport width, documented range 1–5000 pixels. Set a consistent desktop layout width when repeatability matters.
screen_height Desktop viewport height, documented range 1–10000 pixels. Full-page screenshots can be up to 15,000 pixels tall. Set the browser viewport height; it does not mean the final full-page output is limited to that viewport height.
delay Wait after page load for JavaScript; default is 5 seconds. The API reference documents a range up to 60 seconds, while the script guide says a script must finish within the request delay and gives a 10-second example. Allow client-rendered content, animations, or your pre-capture script time to run. Check the limits for the Browshot instance and endpoint you use.
max_wait Optional maximum wait before triggering the PageLoad event; documented range 1–60 seconds, default disabled. The configured delay still applies. Bound the wait for pages that are slow to signal page load.
cache Can reuse a screenshot of the same URL and instance within the cache period. Default documented period is 24 hours; cache=0 requests a new capture. Use cache for repeat requests where freshness is not required; set zero when checking current page state.
hide_popups Option to hide popups such as ads and cookie warnings. Try when overlays obscure content; verify that removal does not hide content you need.
script / script_inline Run JavaScript after page load, from a script URL or inline content. Scroll through pages whose lazy-loaded sections appear only after scrolling.
target CSS selector for capturing a particular element. Use only when you want one element rather than the whole page.

Browshot documents the 15,000-pixel full-page height as a ceiling, not a promise that every page will fit or render completely. Very long pages may need a different document workflow, especially if the deliverable must paginate as a PDF.

3. Load lazy content before the capture

Some pages load images or other content only when a visitor scrolls near them. Browshot’s script guide demonstrates scrolling to the bottom before taking a full-page screenshot. The script runs after the page-load event and must finish within the delay configured for the request.

The following request uses Browshot’s documented scroll-down script example and a 10-second delay. It is an image capture request:

curl -L --fail --show-error \
  --get 'https://api.browshot.com/api/v1/simple' \
  --data-urlencode 'url=https://example.com/' \
  --data-urlencode 'key=YOUR_BROWSHOT_API_KEY' \
  --data-urlencode 'instance_id=65' \
  --data-urlencode 'size=page' \
  --data-urlencode 'delay=10' \
  --data-urlencode 'script=https://browshot.com/static/js/custom/scrolldown.js' \
  --output website.png

The script and instance shown are Browshot’s documented example. If you write your own script, host it at a URL Browshot can load or use script_inline where supported. Make sure its execution completes within the delay. A fixed delay can still be too short for a slow page or unnecessarily long for a fast one.

4. Use the complete API when you need capture status

The simple API is convenient for command-line use. Browshot’s complete API separates capture creation from checking and retrieving the screenshot. It requires an instance_id; the documentation shows the create endpoint and screenshot status fields. A capture can be queued or processing before it is finished, so production code should inspect status before downloading.

Example create request (image output is still PNG):

curl --fail --show-error --get 'https://api.browshot.com/api/v1/screenshot/create' \
  --data-urlencode 'url=https://example.com/' \
  --data-urlencode 'instance_id=12' \
  --data-urlencode 'size=page' \
  --data-urlencode 'key=YOUR_BROWSHOT_API_KEY'

The API responds with screenshot information, including an ID and status. Poll the documented screenshot-info endpoint for that ID until status is finished or error, then retrieve the screenshot using the documented thumbnail or screenshot URL flow. Do not treat the create response as the image bytes. For asynchronous jobs, the API documentation also describes a hook callback when the screenshot finishes or fails.

5. PDF export: what Browshot documentation does and does not establish

The reviewed Browshot API and command-line pages document PNG screenshot responses and full-page capture. They do not identify a PDF output format, a PDF parameter, or a supported procedure for converting the capture into PDF. Therefore, this guide cannot provide a verified Browshot command that produces a PDF.

If PDF is a hard requirement, confirm the export workflow with Browshot’s current documentation or support before building around it. You may need a separate document-rendering or conversion step, but the sources reviewed here do not establish which method Browshot supports or how to perform it. Keep the PNG capture and PDF creation as distinct stages in your design until that point is verified.

6. Python and Node.js request examples

These examples call the simple API and save its returned content as a PNG. They do not create a PDF. Both follow redirects and check for HTTP errors before writing the output.

Python

import os
import requests

api_key = os.environ['BROWSHOT_API_KEY']
response = requests.get(
    'https://api.browshot.com/api/v1/simple',
    params={
        'url': 'https://example.com/',
        'key': api_key,
        'size': 'page',
    },
    timeout=180,
    allow_redirects=True,
)
response.raise_for_status()

with open('website.png', 'wb') as output:
    output.write(response.content)

print('Saved website.png; verify that the response is a PNG image.')

Install the dependency with python -m pip install requests, then set BROWSHOT_API_KEY in the environment before running the script.

Node.js

const apiKey = process.env.BROWSHOT_API_KEY;
if (!apiKey) throw new Error('Set BROWSHOT_API_KEY first');

const params = new URLSearchParams({
  url: 'https://example.com/',
  key: apiKey,
  size: 'page',
});
const response = await fetch(
  `https://api.browshot.com/api/v1/simple?${params}`,
  { redirect: 'follow', signal: AbortSignal.timeout(180_000) }
);
if (!response.ok) {
  throw new Error(`Browshot returned HTTP ${response.status}: ${await response.text()}`);
}
const bytes = Buffer.from(await response.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('website.png', bytes));
console.log('Saved website.png; verify that the response is a PNG image.');

This example uses the built-in fetch API available in current Node.js releases. The timeout is a client-side upper bound, not a Browshot guarantee.

7. Troubleshooting

Symptom Likely cause What to check
Saved file contains a redirect response or is empty The capture was still in progress, or redirects were not followed. For curl, use -L. For other clients, enable redirect following. Check the final HTTP status and content type.
HTTP 400 Invalid request, API key, URL, or parameter. Read Browshot’s X-Error response header; confirm the key and URL and use valid documented parameter values.
HTTP 404 or not-found image The target page could not load or the capture failed. Check that the site is reachable from the capture environment and inspect X-Error. Retry only after correcting the underlying page or request issue.
Capture is incomplete at the bottom Page exceeds practical/documented full-page limit, or content loads only after scrolling. Check the 15,000-pixel documented ceiling. Try the documented scroll script with enough delay; verify whether the page’s lower sections actually loaded.
Images or sections are missing Lazy loading or client-side rendering completed after the screenshot. Increase delay within the supported limit or execute a scroll script that finishes within the delay.
Screenshot is stale A matching screenshot was reused from cache. Request cache=0 for a fresh capture.
Output is PNG when a PDF was expected The documented simple API returns image data; size=page means full-page image. Do not rename the file. Confirm a PDF export or conversion workflow separately; it is not established in the reviewed docs.

8. Performance, reliability, and cost considerations

  • Capture duration: full-page rendering, page scripts, and delays all add time. The simple API is documented as slower than the complete API. Use the complete API when you need to track queue and processing status rather than rely on one synchronous retrieval.
  • Waiting behavior: max_wait bounds the wait before PageLoad, while delay still runs afterward. Set values based on the target page’s behavior and the documented limits for the endpoint/instance.
  • Repeated requests: cache reuse can avoid a new capture for a matching URL and instance within the cache window. Set cache=0 when freshness matters. This is the documented cache behavior; do not assume a cache hit if request parameters or instance differ.
  • Output size: a tall page produces a large raster image, and a 15,000-pixel maximum height can still be unsuitable for a paginated document. Confirm that downstream storage and document tooling can handle the image dimensions.
  • Failure handling: inspect HTTP status for the simple endpoint or status/error fields in the complete API. Retry transient failures with a bounded retry policy; do not repeatedly retry invalid requests or unreachable pages without changing the cause.
  • Billing: the reviewed materials do not provide enough pricing detail to quote a cost for this workflow. Check the current Browshot account and plan terms before estimating batch or production cost.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its one-call API returns a screenshot or PDF, with full-page capture available. The request below asks for a PDF; see the API documentation for current parameters and response handling.

curl -G "https://api.screenshotneo.com/v1/shot" \
  -d access_key=YOUR_API_KEY \
  --data-urlencode url=https://example.com \
  -d format=pdf \
  -d full_page=true \
  -o website.pdf

ScreenshotNeo accepts cookie and consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are never billed, and responses identify the page verdict and billing status. An MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

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

FAQ

Does size=page return a PDF?

No. It requests a full-page screenshot. The official Browshot material reviewed documents PNG image output and does not establish PDF export.

How tall can a Browshot full-page screenshot be?

The API documentation gives a maximum height of up to 15,000 pixels. Treat this as a documented ceiling, not a guarantee for every page or instance.

Why follow redirects when using curl?

Browshot may respond with HTTP 302 while the screenshot is in progress. Its curl guide uses -L so curl follows the redirect to retrieve the image.

Can I make a PDF from the returned PNG?

The reviewed Browshot sources do not specify or endorse an image-to-PDF workflow. Confirm a supported method separately before relying on one.

Sources