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.

Use wkhtmltopdf https://example.com/page output.pdf to convert a web page to PDF. If the result is missing styles or content, first check that the page’s CSS and other resources are reachable, then adjust media mode, JavaScript timing, or viewport settings as appropriate. wkhtmltopdf documents these controls, but they do not guarantee that every modern page will look exactly as it does in a current browser.

Convert a URL to PDF

wkhtmltopdf accepts a URL or filename as input and writes the PDF to the output path you specify. For one web page, run:

wkhtmltopdf https://example.com/page output.pdf

Replace the example URL and filename with your own. The command-line usage manual describes the renderer as “wkhtmltopdf patched qt.” Since the project’s documentation is autogenerated from the installed help output, check your build’s options with wkhtmltopdf -H if a flag behaves differently than expected. The wkhtmltopdf usage manual and project documentation are the primary references.

Check CSS and asset loading first

A URL-based PDF conversion can include only the resources the renderer can load. If the page’s CSS, fonts, or images are unavailable to the conversion process, the PDF may not match the page in a browser. For local HTML, local-file access rules can also prevent the input document from reading adjacent assets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
  • For a local document that needs local assets, use --allow <path> to allow the specific directory or path it requires.
  • --disable-local-file-access blocks local input from reading other local files unless they are explicitly allowed. Avoid broadly enabling access when a narrower allowlist will do.
  • To add a stylesheet of your own, use --user-style-sheet <path>. This loads an additional user stylesheet; it does not ensure that a site’s native CSS or every modern CSS feature renders like a current browser.

For example, to convert a local file while allowing its asset directory and applying an extra stylesheet:

wkhtmltopdf --allow /path/to/assets --user-style-sheet /path/to/extra.css /path/to/page.html output.pdf

Use paths that exist on your system and allow only the files the document needs. Option behavior and availability should be checked against your installed build’s help output. The usage manual documents the local-access and stylesheet options.

Choose screen or print styling

The documented default is screen media. If the page has a print-specific stylesheet and you want that layout, add --print-media-type. If you want its screen layout, leave that flag off. The right choice depends on how the page is authored; neither setting guarantees a better result for every site.

wkhtmltopdf --print-media-type https://example.com/page print-version.pdf

Compare the output with the intended layout after changing this setting. The library settings reference describes the media-type setting and its screen default.

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

Wait for JavaScript-rendered content

JavaScript is enabled by default, and the documented default JavaScript delay is 200 ms. A page that populates content asynchronously may need more time before capture. Try a longer delay:

wkhtmltopdf --javascript-delay 2000 https://example.com/page delayed.pdf

The delay is in milliseconds. If the page exposes a window-status condition that can be used for rendering readiness, --window-status is another documented control. A longer wait can help with delayed content but also makes each conversion take longer; it is not a guarantee that every script-driven page will render successfully. See the usage manual for the option syntax.

Diagnose missing images, backgrounds, or layout

Images or background styling are absent

--images and --background are enabled by default. If those elements are missing, confirm that the page’s image and background resources can be reached and that your command or configuration has not disabled the relevant option. Resource-load errors are ignored by default, so a PDF can be produced even when an asset fails to load.

The page looks too wide, clipped, or unexpectedly scaled

--viewport-size sets a viewport size and may help with pages that use custom scrollbars or CSS overflow behavior. Smart shrinking is enabled by default. Check the viewport and shrinking behavior against the actual page rather than assuming one setting suits all layouts.

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

The conversion stops instead of producing a PDF

Page-load errors abort by default, unlike media-load errors. When diagnosing a failed load, choose error handling deliberately: distinguish a page that cannot load from an individual stylesheet or image that fails. Ignoring an error may let a conversion continue, but it cannot restore missing content.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

These controls are documented options, not a compatibility recipe. Change one setting at a time and inspect the resulting PDF. The settings reference lists relevant page settings, while the usage manual documents command-line flags.

Verify behavior against your installed build

The usage documentation is generated from wkhtmltopdf -H, and the online manual is on a mutable project branch. If a documented option is missing or behaves differently, check the version and help output for the binary you are actually running before changing your command. The project’s documentation page explains this relationship.

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

Or skip the browser setup

If your goal is an automated capture rather than a local wkhtmltopdf conversion, ScreenshotNeo returns a PDF from a GET request and also offers a screenshot API and MCP server. Here is a cURL request for a PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -d format=pdf -o page.pdf

See the ScreenshotNeo API documentation for request options. Before capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

Frequently asked questions

Does a user stylesheet replace the website’s CSS?

No. --user-style-sheet loads an additional stylesheet. It is not a guarantee that the site’s original CSS will load or that all styling will match a modern browser.

Should I use screen or print media for a PDF?

Use the mode that matches the layout you want. Screen media is the documented default; --print-media-type selects print media.

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

Can wkhtmltopdf guarantee identical browser rendering?

No such guarantee is established by the project documentation. Rendering depends on the installed build and the page’s resources, scripts, and styling; inspect the generated PDF for your particular page.

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.