Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk7 min

How to Turn a Website URL Into a PDF Using an API

A practical guide to generating PDF files from website URLs with an API, including request structure, print options, dynamic-page limits, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To turn a website into a PDF programmatically, send an authenticated HTTP request to a PDF-rendering endpoint with the page URL and print options, then save the binary response as a .pdf file. Browserless’s /pdf endpoint is one documented example. Use a browser automation session instead when the page needs clicks, a persistent session, or more involved interaction.

Generate a PDF from a URL with a single API request

Browserless accepts a JSON request at its /pdf endpoint and returns PDF bytes. The token belongs on the server, not in browser-side JavaScript or a publicly shipped application. See the Browserless PDF API documentation for the endpoint schema and current options.

curl -X POST 'https://production-sfo.browserless.io/pdf?token=YOUR_API_TOKEN' 
  -H 'Content-Type: application/json' 
  -H 'Accept: application/pdf' 
  -d '{
    "url": "https://example.com/",
    "options": {
      "format": "A4",
      "printBackground": true,
      "displayHeaderFooter": true
    }
  }' 
  -o page.pdf

Replace YOUR_API_TOKEN with a valid credential and the example URL with the page you are authorized to capture. The command writes the response to page.pdf. Treat the result as binary data; do not decode it as text.

Check the response in application code

Before saving response bytes, check the HTTP status and, where available, the content type. A successful PDF response should be handled as binary. Error responses can indicate a malformed request, failed authentication, a forbidden destination, a timeout, rate limiting, a server error, or service unavailability; surface these to the caller rather than storing an error body with a .pdf extension.

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.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose the input and page options

Use url when the service should navigate to and render a remote page. Use html when your application already has markup to render. Browserless documents these as alternative inputs, not fields to send together. Its endpoint-specific schema is the authority for exact names and supported values.

Need Option to consider What to check
Standard paper dimensions format, such as A4 or Letter Choose the intended paper size for the audience and document.
Custom page dimensions Custom width and height Check the endpoint schema for accepted units and dimension syntax.
Room around content Margins Set margins to avoid clipping headers, footers, or page content.
Wide layouts Landscape orientation Confirm that the page layout benefits from a wider printable area.
Specific parts of a long document Page ranges Use the provider’s documented range syntax.
Branded or labeled pages Headers and footers Enable them only when the generated document needs them.
Background colors and images printBackground Enable background printing when those visuals matter to the document.

The schema also describes provider-specific navigation and waiting controls, cookies, request interceptors, user-agent settings, and resource blocking. Check the live documentation before depending on any of these in production; their exact behavior is not universal across PDF APIs.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Decide whether a one-request API is enough

A REST PDF call is suited to a single navigation-and-render task. Browserless describes its REST APIs as stateless, single-action requests: cookies and browser state do not persist across requests, and one call does not carry out a multi-step workflow such as signing in, clicking through a page, and capturing the result.

For interactive pages, use a browser connection or custom browser function so code can navigate, wait for a page condition, interact, and then create the PDF. Browserless’s example uses Puppeteer to navigate, wait for networkidle2, call page.pdf(), and save the returned bytes. See the Browserless Puppeteer connection documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • Prefer a direct PDF endpoint for a straightforward URL or HTML input and a conventional document.
  • Prefer browser automation when a workflow needs clicks, session state, or explicit waits for page content.
  • Do not assume an automated request will be accepted by every site. Bot checks, interactive challenges, or destination restrictions can prevent capture; honor site access rules and report failures accurately.

Understand print styling, accessibility, and page shape

Print appearance can differ from the screen

Puppeteer’s page.pdf() renders using the print CSS media type. A site may therefore use different styles, hide screen-only elements, or add page breaks in the PDF. If you need screen styling, Puppeteer documents emulating screen media before generating the PDF. Print rendering can also modify colors by default; the CSS property -webkit-print-color-adjust can be used when exact color rendering is required. See the Puppeteer page.pdf() documentation.

Tagged output is not a compliance certificate

Browserless says its PDFs contain selectable text rather than being screenshots. Its tagged: true option can add structural tags, including reading order and headings, which may help assistive technology and document parsers. The result is not certified PDF/UA, and its accessibility still depends on the source markup. If formal conformance matters, validate the generated file with an appropriate validator. See the Browserless PDF API documentation.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Continuous single-page output requires a different workflow

A normal PDF is paginated. Browserless states that its /pdf REST endpoint does not create one continuous, very tall page for an entire website. Its documented route for that result is custom code through /function, which can calculate the page height and set the output format. See the Browserless PDF API documentation.

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

Or skip the browser setup

ScreenshotNeo is a screenshot API and MCP server for developers. Its endpoint returns PNG, JPEG, WebP, or PDF output from one GET request. For a PDF, adapt the target URL in the API request and check the current ScreenshotNeo documentation for PDF options and response handling:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Change the output filename and format settings as needed for PDF output. ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step 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. Its MCP server exposes screenshot and PDF tools for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan.

Handle failures and production concerns

Common failure causes

  • Malformed request: Check that the JSON is valid, that required fields are present, and that you have not sent both url and html.
  • Authentication failure: Verify the token and keep it in server-side configuration. Do not put it in a public page or client bundle.
  • Forbidden destination: The endpoint may reject a destination. Confirm you are permitted to access the site and inspect the provider’s response details.
  • Timeout or incomplete page: A page may take longer to load or depend on dynamic content. Use documented wait controls or move to browser automation when the capture needs a page condition or interaction.
  • Rate limit or service error: Handle non-success statuses explicitly and apply a retry policy appropriate to the status and provider guidance. Avoid blindly retrying a request that is consistently forbidden or malformed.
  • PDF looks different from the page: Check print CSS, background printing, page size, margins, and page-break rules. Use screen media emulation in a Puppeteer workflow if the screen presentation is the desired one.

Cost, performance, and reliability

The available provider documentation establishes request capabilities and failure categories but does not provide a comparable benchmark for rendering speed, service reliability, or current Browserless pricing. Measure the latency and failure rate for your own pages and workload, and consult the provider’s current plan and operational documentation before setting budgets or service-level expectations.

For a production integration, set an application timeout, preserve the provider’s status and error details in logs, and distinguish a failed render from a successfully returned PDF. If jobs may take longer than an interactive request allows, design the calling workflow to report progress or retry only where appropriate. Keep credentials server-side and avoid logging them.

Another option for a website you control

DocRaptor documents a referrer-based flow for pages controlled by the account holder: configure permitted domains and link to its /docs/from_site endpoint. In that particular flow, requests whose referrer contains a configured domain can use the account without an API key in the request. JavaScript and PDF options can be passed as query parameters. This is a specialized architecture for a site you control, not a general anonymous URL-to-PDF converter.

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

Implementation checklist

  • Choose whether the input is a URL or HTML.
  • Set the page format, orientation, margins, background behavior, and any required headers or page ranges.
  • Keep API credentials on the server and use HTTPS.
  • Check HTTP status and content type before writing binary output as a PDF.
  • Use a browser session for multi-step interaction or persistent browser state.
  • Validate the resulting appearance, selectable text, and accessibility needs against the actual document requirements.

Frequently Asked Questions

Can I convert HTML I already have instead of a live URL?

Yes. Browserless documents an html input as an alternative to url; do not send both in the same request.

Will a generated PDF always match what I see in a browser window?

No. PDF generation uses print styling by default in Puppeteer, and print CSS and color handling can change the output.

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.

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. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

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.