ScreenshotNeo

BlogHow-to

How to install wkhtmltopdf on Ubuntu in India

Install wkhtmltopdf on Ubuntu in India using the package that matches your release and architecture. Includes apt and upstream-package steps, troubleshooting, and security guidance.

By the ScreenshotNeo team4 October 20266 min read

On a typical Ubuntu installation, install the distribution package with apt:

sudo apt update
sudo apt install wkhtmltopdf
wkhtmltopdf --version

There is no India-specific wkhtmltopdf package in the sources reviewed. Choose a package for your Ubuntu release codename and CPU architecture; the apt package normally handles that selection using the repositories configured on your machine. Ubuntu’s archive records the package for Ubuntu 22.04 and 24.04, but availability, version, architecture, and dependencies should be checked for your exact system. [Ubuntu 22.04 package record] [Ubuntu 24.04 package record]

1. Check your Ubuntu release and architecture

Before installing, identify the Ubuntu codename and CPU architecture. This matters especially if you plan to download an upstream .deb manually.

. /etc/os-release
printf 'Ubuntu release: %s (%s)\n' "$VERSION_ID" "$VERSION_CODENAME"
dpkg --print-architecture

The codename is typically a value such as jammy or noble. Keep both values available when choosing a package. Do not assume a package built for a different Ubuntu release will work, even if the CPU architecture is the same.

2. Install the Ubuntu archive package

For most readers, the Ubuntu archive package is the simplest starting point:

sudo apt update
sudo apt install wkhtmltopdf
wkhtmltopdf --version

apt update refreshes repository metadata; it does not upgrade every installed package. apt install resolves dependencies from the repositories configured for your release. The final command prints the installed program’s version, confirming that the executable can be found.

To check whether apt can see the package before installing:

apt-cache policy wkhtmltopdf

If the output shows a candidate version, apt has a package available from a configured source. If it says Candidate: (none), check that the appropriate Ubuntu repository component is enabled and that your package lists were updated. Ubuntu lists wkhtmltopdf in Universe for the researched 22.04 and 24.04 releases. [Jammy package details] [Noble package details]

3. Choose an upstream package when you need one

The wkhtmltopdf project’s downloads page identifies 0.12.6 as its stable series and lists Ubuntu builds for 22.04 (jammy), 20.04 (focal), and 18.04 (bionic), with architecture support varying by release. Ubuntu archive packaging is a separate route: for example, Ubuntu 24.04 lists 0.12.6-2build2, while the Jammy source package is 0.12.6-2. Check the current project downloads and Ubuntu records for your exact release before choosing. [wkhtmltopdf official downloads] [Ubuntu Noble record] [Ubuntu Jammy record]

  1. Read the release codename and architecture using the commands above.
  2. Open the official downloads page and select a build matching both values exactly, if one is listed.
  3. Download the matching .deb file from that page. Do not substitute a build for a different Ubuntu release based on its filename alone.
  4. Install the local package through apt so apt can resolve dependencies:
sudo apt install ./wkhtmltox_VERSION.ubuntu_CODENAME_arch.deb
wkhtmltopdf --version

Replace the example filename with the file you actually downloaded. The project notes that a package that cannot be installed may be extracted, but extraction does not supply missing dependencies; it is not a routine compatibility fix. [Project download guidance]

4. Confirm that PDF conversion works

Check the executable version, then make a small PDF from a page you are allowed to access:

wkhtmltopdf --version
wkhtmltopdf https://example.com sample.pdf
file sample.pdf

This is a basic smoke check, not a guarantee that every website will render correctly. Pages that rely on scripts, remote resources, authentication, or browser features can behave differently from a normal interactive browser.

For a local HTML file, pass its path as the input:

wkhtmltopdf ./input.html ./output.pdf

5. India-specific package and mirror questions

You do not need a special India build according to the reviewed upstream and Ubuntu sources. Select by Ubuntu codename and CPU architecture. Apt uses the Ubuntu archive mirror configured for your system; the available evidence does not establish that any particular Indian mirror is fastest or currently available, so keep the configured mirror unless it is failing and check its status through your usual Ubuntu repository settings.

6. Common installation and conversion problems

Symptom Likely cause What to do
Unable to locate package wkhtmltopdf Package lists are stale, or the relevant repository component is not enabled for this release. Run sudo apt update, inspect apt-cache policy wkhtmltopdf, and check the Ubuntu repository configuration for your release.
Package has no installation candidate Your configured sources do not offer the package for that release or component. Verify the release codename and enabled repository components. Consult the Ubuntu package record for that release before choosing another installation route.
Local .deb reports unmet dependencies The package may require libraries not present in your configured sources, or it may target another Ubuntu release. Confirm codename and architecture, then use sudo apt install ./file.deb to let apt resolve available dependencies. Prefer the Ubuntu archive package if the upstream build does not match your system.
wkhtmltopdf: command not found Installation did not complete, or the executable is not on the current PATH. Check dpkg -l wkhtmltopdf and command -v wkhtmltopdf. Review apt’s installation output and resolve any reported package error.
Command runs but output is blank or incomplete The source page may fail to load, depend on scripts or remote assets, or take longer to render than expected. Try a known simple page, confirm the URL is reachable from the machine, and inspect the converter’s error output. Do not treat a successful package installation as proof that every site is convertible.
Works locally but fails on a server The server can have different installed libraries, network access, fonts, or runtime permissions. Check the server’s Ubuntu release and architecture, install through its matching repositories, and verify access to the input page and resources.

7. Security, reliability, and cost considerations

Do not convert untrusted HTML as if it were safe

The wkhtmltopdf project warns: “Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTML/JS, otherwise it can lead to complete takeover of the server you are running it on!” Sanitize user-supplied content and do not expose a server-side converter to arbitrary HTML or JavaScript. [wkhtmltopdf project guidance]

Check each target and environment

Conversion depends on the target page and the machine running the program. Network failures, unavailable assets, authentication requirements, and release-specific dependencies can all affect results. Confirm representative inputs in the same Ubuntu environment you will use in production, and handle nonzero exit codes and missing or invalid output in your calling application.

Budget for the machine, not a per-conversion fee

wkhtmltopdf is software you install and run on your own machine or server; the sources reviewed do not specify a per-document service price. Account for the time and resources needed to maintain the Ubuntu environment, its dependencies, and safe input handling. The research does not establish a performance benchmark, so measure conversion time and resource use with your own representative documents.

8. Or skip the browser setup

If your task is taking a screenshot or PDF of a web page, ScreenshotNeo provides a website screenshot API and MCP server. A single request can return an image or PDF; its API documentation describes the available parameters.

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

Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

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

9. FAQ

Is wkhtmltopdf available on Ubuntu 24.04?

Ubuntu’s Noble package record lists it as 0.12.6-2build2. Check the package record and your configured repositories for current availability on your architecture. [Ubuntu Noble package record]

Can I install the Jammy .deb on Noble?

Do not assume it is compatible. Use a package matching your Ubuntu codename and architecture, or use the Ubuntu archive package available for your release.

Do I need a special Indian mirror?

No India-specific package is identified in the reviewed sources. Apt uses your configured Ubuntu mirror; package choice is based on release and architecture.

What should I use if I only need a web page screenshot or PDF?

You can use wkhtmltopdf on your own system, or make a one-call request to ScreenshotNeo when you want a hosted capture API. The latter requires an API key and is billed according to its plan and response outcome.