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

To save a rendered web page as a PDF with one curl command, send the page URL to a browser-rendering API and save its PDF response. curl makes the HTTP request; the remote browser does the rendering. For a local alternative, Chrome Headless can create the PDF directly from the command line.

Use a rendering API for a one-command curl conversion

Cloudflare’s Browser Run PDF endpoint accepts a URL in a JSON POST request and returns a PDF response. Its documented command is:

curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-run/pdf' 
  -H 'Authorization: Bearer <apiToken>' 
  -H 'Content-Type: application/json' 
  -d '{"url":"https://example.com/"}' 
  --output output.pdf

Replace <accountId> and <apiToken> with your Cloudflare account ID and API token. The token needs the Browser Rendering - Edit permission. The command writes the endpoint’s response to output.pdf in the current directory. Cloudflare also accepts an html field instead of a URL; its documented request-body limit is 50 MB, a limit for this endpoint rather than for PDFs generally. See Cloudflare’s Browser Run documentation for current endpoint and account requirements.

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

This is a hosted service request, not an unauthenticated or inherently free conversion. Confirm the service’s current access and billing terms before using it.

#1 Best Overall
Brother Compact Monochrome Laser Printer, HLL2395DW, Flatbed Copy & Scan, Wireless Printing, NFC with Refresh Subscription Free Trial and Amazon Dash Replenishment Ready
  • Engineered for convenience – This new Brother Monochrome Laser Printer is conveniently equipped with a flatbed scan glass for quick copying and scanning. Mobile Device Compatibility AirPrint, Google Cloud Print 2.0, Brother iPrint and Scan, Mopria, Cortado Workplace
  • Optimized for efficiency – Engineered with new features, the HL L2395DW laser printer (replacement for the HLL2380DW) and has been optimized for efficiency, allowing you to print up to 36 pages per minute(1)
  • Faster, high quality prints: This monochrome laser printer is built with a 250 sheet paper capacity that helps improve efficiency due to less time spent refilling trays. It also handles both letter and legal sized paper. Power Source AC 120V 50/60Hz.Machine Noise (Ready/Printing): 30dB / 50dB
  • Cloud based print & scan – Print from and scan to popular Cloud services directly from the 2.7" color touchscreen, including Dropbox, Google Drive, Evernote, OneNote, and more(4)
  • Wireless printing & exceptional support – This printer’s simple to connect wireless technology allows you to submit print jobs from your laptop, smartphone, desktop, and tablets(2). The "Touch to connect" printing with NFC delivers added convenience(3).

Why raw curl cannot print a web page

A command such as curl 'https://example.com/' > page.pdf saves the HTTP response body; it does not ask a browser to lay out the page and print it. The result is generally HTML, not a browser-rendered PDF. Chrome’s documentation distinguishes retrieving HTML with curl from parsing a page, running its scripts, and rendering it for print. The hosted API above works because it supplies the browser-rendering step that curl itself does not provide. See Chrome’s Headless documentation.

Choose between a hosted API and local rendering

Method Where rendering happens Command or request Relevant considerations
Cloudflare Browser Run Hosted browser Authenticated POST with a URL or HTML body; save the response with --output Requires an account and a token with the documented permission. Offers controls for page format, margins, backgrounds, viewport, headers and footers, resource blocking, and page-load waits. Request bodies are limited to 50 MB.
Chrome Headless Your machine chrome --headless --print-to-pdf https://example.com/ Requires Chrome available locally. Output is saved as output.pdf in the current working directory. Flags include controls for print headers and footers and capture timing.
wkhtmltopdf Your machine wkhtmltopdf http://example.com/ output.pdf A separate command-line tool using Qt WebKit. Its manual documents options for JavaScript, cookies, custom headers, print media, and local-file access.

For Chrome, --no-pdf-header-footer omits the print header and footer. --timeout=5000 caps the capture wait at five seconds, while --virtual-time-budget can advance time-dependent page code during capture. Check the flags supported by your installed Chrome version; compatibility varies, and the no-header option replaced an older spelling. Details are in the Chrome Headless documentation.

Rank #2
Brother MFC-L3710CW Compact Digital Color All-in-One Printer Providing Laser Printer Quality Results with Wireless, Amazon Dash Replenishment Ready
  • FAST PRINT AND SCAN: The Brother MFC-L3710CW lets you get things done with up to 19 ppm print speed and scans up to 29 ipm in black and 22 ipm in color
  • AFFORDABLE AND FLEXIBLE COLOR PRINTING: Affordably print professional quality, rich, vivid color documents with laser printer quality. The 250 sheet adjustable paper tray helps minimize refills and the manual feed slot handles varied printing needs
  • 3.7” COLOR TOUCHSCREEN: Print from and scan to popular cloud apps directly from the 3.7" color touchscreen including Dropbox, Google Drive, Evernote, OneNote and more. Save time by creating custom shortcuts on the touchscreen for your most used features.
  • PRINT AND CONNECT YOUR WAY: Print wirelessly from your desktop, laptop, smartphone and tablet with built-in wireless, and Wi-Fi Direct or connect locally to a single computer via USB interface.
  • UNIT DIMENSIONS (WxDxH): 16.1” W x 18.7” D x 16.3” H

The wkhtmltopdf project describes the tool as an open-source command-line converter under LGPLv3. Its project site and 0.12.6 manual describe its options. These tools use different rendering engines and controls; the cited documentation does not establish that one produces universally more faithful PDFs.

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.

Handle pages that render after the initial load

A URL-only request may capture a page before its JavaScript has finished filling in content. This is common with single-page applications and other dynamic pages: a browser can consider navigation complete while scripts are still working. Cloudflare recommends configuring the browser’s navigation wait condition, such as networkidle0 or networkidle2, or waiting for a specific selector when the required content is known. Its endpoint supports page-load controls; consult the Browser Run documentation for the request syntax.

Rank #3
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
  • Create a mix using audio, music and voice tracks and recordings.
  • Customize your tracks with amazing effects and helpful editing tools.
  • Use tools like the Beat Maker and Midi Creator.
  • Work efficiently by using Bookmarks and tools like Effect Chain, which allow you to apply multiple effects at a time
  • Use one of the many other NCH multimedia applications that are integrated with MixPad.

When using Chrome locally, the --timeout and --virtual-time-budget options can affect capture timing. A longer wait can help, but it cannot guarantee that a site will finish rendering or allow access.

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

Check access, formatting, and failures

  • Authentication: A page that requires a login may not be available to a remote rendering service. Do not assume your local browser’s signed-in session is shared with it. The Cloudflare endpoint supports request controls such as headers, but whether a particular site permits access depends on that site and the service configuration.
  • Bot protection: Cloudflare says Browser Run requests are identifiable as bot traffic; setting a userAgent does not bypass bot protection. A protected site can refuse or limit capture.
  • Incomplete output: If expected content is missing, configure an appropriate wait condition or wait for a known selector. Check the resulting PDF rather than assuming that a successful HTTP request means the page finished rendering.
  • Print layout: Page size, margins, landscape orientation, scale, backgrounds, and headers or footers can change the result. Cloudflare documents controls for these settings. In Chrome, --no-pdf-header-footer removes its print header and footer.
  • API errors: A hosted request can fail because of invalid credentials, an unsupported or malformed request, service limits, or destination-site restrictions. Check the provider’s response and current documentation; a curl command is only the request client.

Another provider documents this GET-style example, which redirects the returned PDF bytes into a file:

Rank #4
Corel PDF Fusion Software
  • Save money by using PDF Fusion to view over 100 file formats without having to purchase additional software
  • Merge incompatible files quickly and easily by dragging and dropping in PDF Fusion to create a new PDF documents
  • Save time with PDF Fusion's editing tools to reuse the content from existing documents without starting from scratch
curl 'https://service.headless-render-api.com/pdf/https://example.com/' > out.pdf

That provider recommends sending an API token to avoid rate limiting and documents possible 429 responses in token or billing scenarios. It is one vendor’s endpoint, not a general curl URL format or a guarantee of free access. See its PDF API documentation for its options and error conditions.

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.

Quick Recap

Bestseller No. 3
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
MixPad Free Multitrack Recording Studio and Music Mixing Software [Download]
Create a mix using audio, music and voice tracks and recordings.; Customize your tracks with amazing effects and helpful editing tools.
Bestseller No. 4

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.