October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Generate a PDF from a URL with Browserless

Use Browserless's /pdf REST endpoint to turn a URL or HTML into a saved PDF, with practical examples, print controls, and guidance for continuous-page captures and failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To generate a paginated PDF from a webpage with Browserless, send an authenticated POST request to its /pdf REST endpoint, provide the page URL as JSON, and save the response bytes as a .pdf file. The endpoint also accepts HTML instead of a URL and supports print settings such as paper size, margins, orientation, backgrounds, and headers or footers.

What you need and how the request works

You need a Browserless API token. Use the regional REST endpoint shown in the Browserless documentation or your account configuration; the documented example below uses the SFO production endpoint. The token is sent as the token query parameter, and the request body is JSON. A successful request returns raw PDF data with an application/pdf content type, not JSON or a base64-encoded value.

As an Amazon Associate I earn from qualifying purchases.

Use one of url or html in the body, not both. Browserless describes /pdf as its preferred REST route; /chromium/pdf is documented as equivalent. See the Browserless PDF API documentation for current endpoint details.

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

Generate and save the PDF with cURL

Replace the token placeholder with a token from your Browserless account, and change the URL to the page you want to render:

#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
curl -X POST 
  "https://production-sfo.browserless.io/pdf?token=YOUR_API_TOKEN_HERE" 
  -H 'Content-Type: application/json' 
  -H 'Accept: application/pdf' 
  -d '{
    "url": "https://example.com/",
    "options": {
      "format": "A4",
      "printBackground": true,
      "displayHeaderFooter": true
    }
  }' 
  -o result.pdf

-o result.pdf writes the response body directly to a file. The Accept header is shown in the API reference example; the response is documented as PDF binary regardless. For a minimal request, the body can be just {"url":"https://example.com/"}. Browserless’s PDF API reference lists the request options and response behavior.

Use JavaScript or Python

JavaScript with Node.js

This example uses Node’s built-in fetch and writes the binary response. Save it as an .mjs file or run it in a Node environment that supports top-level await:

import { writeFile } from 'node:fs/promises';

const endpoint = 'https://production-sfo.browserless.io/pdf';
const token = process.env.BROWSERLESS_TOKEN;
if (!token) throw new Error('Set BROWSERLESS_TOKEN first');

const response = await fetch(`${endpoint}?token=${encodeURIComponent(token)}`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/pdf'
  },
  body: JSON.stringify({
    url: 'https://example.com/',
    options: {
      format: 'A4',
      printBackground: true,
      displayHeaderFooter: true
    }
  })
});

if (!response.ok) {
  throw new Error(`Browserless returned HTTP ${response.status}: ${await response.text()}`);
}

await writeFile('result.pdf', Buffer.from(await response.arrayBuffer()));

Reading the response as an ArrayBuffer and writing its bytes avoids treating the PDF as text. Browserless’s JavaScript example follows this binary-save pattern; consult Generate a PDF for its documented examples.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Python with requests

import os
import requests

endpoint = "https://production-sfo.browserless.io/pdf"
token = os.environ.get("BROWSERLESS_TOKEN")
if not token:
    raise RuntimeError("Set BROWSERLESS_TOKEN first")

response = requests.post(
    endpoint,
    params={"token": token},
    headers={
        "Content-Type": "application/json",
        "Accept": "application/pdf",
    },
    json={
        "url": "https://example.com/",
        "options": {
            "format": "A4",
            "printBackground": True,
            "displayHeaderFooter": True,
        },
    },
    timeout=90,
)
response.raise_for_status()

with open("result.pdf", "wb") as pdf_file:
    pdf_file.write(response.content)

Binary mode ("wb") preserves the response bytes. Check response.raise_for_status() before writing so an HTTP error body is not accidentally saved with a PDF extension. Browserless documents Python and cURL generation patterns in its PDF quick start.

Choose print options for the document

Pass rendering settings in the request’s options object. The available controls let you adapt printed pages without changing the target site’s own styles:

  • Page dimensions: choose a named format such as A4 or Letter, or set width and height.
  • Orientation and scale: use landscape where the content is wider than it is tall, and adjust scale when needed.
  • Margins: set margins to preserve room for annotations, binding, or printer limits.
  • Printed appearance: enable background graphics when colors or background images carry information; enable headers and footers when the document needs them.
  • Page selection: specify page ranges when only part of a long result is needed.
  • Rendering readiness and structure: configure font readiness and, where appropriate, tagged output.
  • CSS page rules: CSS @page sizing can take precedence when configured to do so, so inspect the page’s print styles if the output dimensions differ from the requested format.

For dynamic pages, the API also documents navigation and waiting controls, cookies, HTTP authentication, extra headers, scripts, styles, and related request configuration. Choose a wait condition that matches how the page loads; a page that fills in after initial navigation may otherwise print before its content is ready. Option names and behavior are documented in the PDF API reference.

Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

Paginated PDF versus one continuous page

The REST /pdf endpoint creates a conventional paginated PDF; it does not make one extremely tall page containing an entire long webpage. Browserless explicitly notes this limitation in its PDF API documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Need Browserless path What to expect
Ordinary multipage PDF from a URL or HTML /pdf REST endpoint Direct HTTP request; returns PDF binary.
One continuous page for a long webpage /function with custom Puppeteer code Requires custom rendering logic, including calculating the page height.

Use /function only when continuous-page output is a requirement and you are prepared to implement that custom logic. Browserless documents the approach in its PDF API guidance.

Text, accessibility, and document metadata

Browserless says Chrome’s print output contains selectable text. Its tagged: true option adds structural tags, but that does not certify the file as PDF/UA. Accessibility quality still depends on the source page’s markup, and formal compliance should be validated with an appropriate PDF accessibility checker.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management

The documented /pdf route does not set common document metadata such as Title or Author during generation. If those fields matter, add them afterward with a PDF-processing library such as pdf-lib. These limitations are described in the Browserless PDF API documentation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handle failures and large documents

Browserless documents errors for malformed request data and status responses for authorization failures, forbidden destinations, not-found conditions, timeouts, rate limits, internal errors, and service unavailability. Check both the HTTP status and the response body before assuming a saved file is a valid PDF.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Authorization error: verify the token value and that it is passed as the token query parameter.
  • Malformed request: send valid JSON with Content-Type: application/json; use exactly one of url or html.
  • Forbidden destination or not found: confirm that the destination is reachable and permitted, and that the URL is correct.
  • Timeout: the page may be slow or depend on delayed content. Select a suitable wait/navigation control and check whether the site requires cookies, authentication, or extra headers.
  • Rate limit or service unavailable: check the returned status and retry according to your application’s retry policy rather than treating an error response as a PDF.
  • Very long document fails: the PDF API guide advises splitting the work into pageRanges chunks and merging the resulting PDFs afterward.
  • Wrong paper size: inspect the page’s CSS @page rules and the PDF options; CSS sizing may take precedence when configured to do so.

For very long documents, generating smaller page-range chunks can make a job easier to handle, but it adds a merge step and does not create a continuous page. Refer to the API’s status codes and pageRanges guidance in the PDF API reference.

Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

Or skip the browser setup

If your goal is a clean screenshot rather than a paginated PDF, ScreenshotNeo can return an image with one GET request. Its screenshot workflow accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; individual cleanup steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers indicate the page verdict and billing status. It also provides an MCP server for AI agents, with tools including take_screenshot, get_page_info, and capture_pdf.

Example cURL request (replace the URL and API key):

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 request options and account setup. ScreenshotNeo offers 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo to try the free monthly allowance.

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.

Frequently Asked Questions

Can Browserless make a PDF directly from HTML instead of a public URL?

Yes. Send the HTML in the request body instead of the url field; do not include both.

Does Browserless add a PDF title or author automatically?

The documented /pdf route does not set common metadata fields such as Title or Author. Add them afterward with a PDF library if needed.

Does tagged: true guarantee PDF/UA compliance?

No. It adds structural tags, but Browserless does not certify the result as PDF/UA; validate the generated file separately.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.