Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk6 min

How to Capture a Website Behind a Login with wkhtmltoimage

wkhtmltoimage can request a protected page with supported credentials such as an existing session cookie, but it does not perform an interactive login. Learn the safe workflow and when a browser-based capture is a better fit.

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.

wkhtmltoimage can capture an authenticated page if you give it credentials it understands: HTTP authentication details or a valid session cookie. It does not document an interactive browser login, so it cannot be relied on to complete a site’s login form, MFA challenge, or SSO flow. For an authorized page, sign in using the site’s supported process, pass the resulting session cookie to the renderer, then inspect the image to confirm you reached the intended page.

What wkhtmltoimage can and cannot do

wkhtmltoimage is a headless HTML-to-image command-line renderer built around Qt WebKit. The project’s documentation says it runs without a display service. Its options include HTTP authentication credentials, cookies, and custom headers: these supply request information, not an interactive browser session that performs a site’s login sequence. Project documentation · Debian bookworm wkhtmltoimage manual

As an Amazon Associate I earn from qualifying purchases.

A successful normal sign-in commonly results in a session cookie being returned by the server. That cookie may let a later request identify the signed-in session, but its scope and lifetime depend on the site. MDN’s guide to HTTP cookies explains the browser cookie model. A cookie supplied to wkhtmltoimage does not by itself reproduce redirects, JavaScript challenges, MFA, SSO, or other steps that may be part of sign-in. Confirm the behavior on the specific site and only capture pages you are authorized to access.

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

Capture an authorized page with a session cookie

  1. Sign in through the site’s normal supported flow. Use an approved method to obtain a valid session cookie for the account and page. Do not try to bypass access controls or anti-bot checks.
  2. Check the installed command’s options. Package builds can differ; consult wkhtmltoimage --help and the manual installed with your version before using options.
  3. Pass the cookie and capture the target URL. The manual documents --cookie <name> <value> for a cookie and --cookie-jar <path> for cookie-jar handling. For example, using placeholders only:
    wkhtmltoimage --cookie SESSION_COOKIE_NAME SESSION_COOKIE_VALUE https://example.com/account report.png
    Replace the URL and placeholders with values appropriate to the site. This example illustrates syntax; it does not establish that a particular site will accept a supplied cookie.
  4. Allow time for the page to render if needed. If the page relies on JavaScript, the manual documents --enable-javascript and --javascript-delay <msec>. If the page sets a known readiness value on window.status, use --window-status <value>. These options do not guarantee that all network requests or dynamic content have finished.
  5. Open the output and verify it. Check that it shows the intended authenticated page, not a login redirect, blank shell, error page, or incomplete content. Adjust the wait strategy and dimensions for the target site’s layout.

Example with a delay and a chosen viewport, using illustrative values that may need adjustment:

wkhtmltoimage --enable-javascript --javascript-delay 1500 --width 1280 --height 900 --cookie SESSION_COOKIE_NAME SESSION_COOKIE_VALUE https://example.com/account report.png

The manual also documents --custom-header <name> <value> and --custom-header-propagation for sending a custom header with resource requests as well as the main page. Use these only when the target’s documented authentication or application flow requires them; forwarding a credential-bearing header to page resources can expose it more widely than intended.

Rank #2
Free Fling File Transfer Software for Windows [PC Download]
  • Intuitive interface of a conventional FTP client
  • Easy and Reliable FTP Site Maintenance.
  • FTP Automation and Synchronization

Use HTTP authentication when the site supports it

For HTTP authentication, the manual documents --username and --password. A basic syntax example is:

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

wkhtmltoimage --username USERNAME --password PASSWORD https://example.com/private-page private.png

This applies to HTTP authentication supported by the server, not a username-and-password form rendered inside an ordinary web page. Avoid putting real passwords or live cookie values directly in commands: shell history may retain them, and process inspection can expose command arguments. Use a controlled, access-restricted environment and a protected cookie-jar or other approved credential-handling method where available. The manual documents a cookie-jar option but does not prescribe a secure storage policy.

Choose output size and rendering behavior

The manual includes controls for output format and quality, viewport width and height, cropping, and zoom. Select values based on the page’s layout and the portion you need; no single viewport or delay works for every site. For local resources, the manual documents --disable-local-file-access and a narrowly scoped --allow option when access to specific local files is required. Keep local-file access restricted unless the capture genuinely needs it.

  • JavaScript-dependent pages: enable JavaScript only when needed, then use a delay or documented window.status readiness signal if the page provides one.
  • Long or responsive pages: test viewport and crop settings against the output; viewport dimensions can change layout and wrapping.
  • Output format: choose the supported image format and quality settings using the installed version’s help or manual.
  • Dynamic loading: neither a delay nor a status signal guarantees that all images, requests, or application data have completed.

Protect the session and troubleshoot the result

Symptom Likely cause What to check
The screenshot shows a login page The cookie is missing, expired, scoped to another host/path, or the site requires additional steps. Sign in again through the supported flow, confirm the cookie applies to the target URL, and verify whether redirects or extra requests are part of authentication.
The page is blank or only partly rendered JavaScript or delayed page content was not ready when capture occurred. Try enabling JavaScript and a suitable documented delay or window.status wait, then inspect the output again.
HTTP authentication is rejected The server may not use HTTP authentication, or the credentials may be incorrect. Confirm the site’s authentication mechanism; the username/password flags are not a substitute for submitting a web login form.
Some page resources fail Resources may need a custom header, or the site may depend on browser behavior the renderer does not reproduce. Check the target’s requirements before adding a custom header. Use header propagation only if required and safe for resource requests.
Option is unrecognized or behaves differently The installed package’s options may differ from the cited manual version. Use that installation’s own help and manual for exact syntax.

Treat session cookies as credentials: do not put live values in public examples, shared logs, source control, or broadly readable files. Cookie scope, expiry, redirects, and anti-bot behavior vary by site. A screenshot that looks plausible is not proof that the intended account state was captured, so check sensitive output before storing or sharing it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to use a current browser-based workflow

The upstream wkhtmltopdf repository was archived on January 2, 2023, and its changelog lists version 0.12.6, released June 11, 2020. Those project-history dates are a reason to be cautious with modern sites, not a guarantee that any particular capture will fail. For complex JavaScript or interactive sign-in, a current browser automation or headless Chromium workflow may be more appropriate. Chrome’s official documentation describes command-line screenshots and notes the role of capture timeouts; a timeout does not mean page content necessarily finished loading. Chrome Headless command-line reference · wkhtmltopdf changelog

Or skip the browser setup

ScreenshotNeo accepts a URL in a single request and returns an image or PDF. It removes cookie/consent banners, newsletter popups, and chat widgets before capture; those cleanup steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server offers screenshot tools for AI agents. Plans include 1,000 screenshots per month free with no card, and paid plans start at $5 for 3,000. ScreenshotNeo

cURL example (replace the target URL and API key):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/account -o shot.webp

See the ScreenshotNeo API documentation for request options and response details. Sign up for 1,000 free screenshots a month, with no card required.

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

Frequently Asked Questions

Can wkhtmltoimage complete an MFA or SSO login?

Its documented authentication options provide request credentials such as cookies or HTTP authentication; they do not document completing interactive MFA or SSO flows.

Why does a screenshot with a session cookie still show a login page?

The session may be invalid or outside its cookie scope, or the site may require additional redirects, requests, or browser-mediated steps. Verify the cookie and target flow through the site’s supported login process.

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. 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
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.