---
type: WebPage
title: "wkhtmltopdf for Python: keep pdfkit, swap the engine | Marqius"
description: Keep pdfkit, django-wkhtmltopdf and imgkit. Point them to a
  compatible Marqius executable, then render and compare your own Python PDFs.
resource: https://marqius.com/wkhtmltopdf/python/
tags:
  - marqius
  - products-and-guides
status: stable
sources:
  - id: official-page
    resource: https://marqius.com/wkhtmltopdf/python/
generated:
  by: process:marqius-site-build
  at: 2026-11-20T10:17:10.036Z
x_marqius:
  language: en
  source_sha256: d39880bb38e629d4e005b3b0f3787b7932ca77613b6ba477c3c08dd64b7fe1c2
  extraction: public-main-content
---

PYTHON · PDFKIT · DJANGO · IMGKIT

# Keep pdfkit.  
_Replace wkhtmltopdf._

pdfkit runs the wkhtmltopdf command. Install Marqius under that name, and your Python PDF calls can stay the same.

```
curl -fsSL https://marqius.com/marqius-wkhtmltopdf.sh | bash
```

[Start your 30-day trial](https://marqius.com/app/sign-in/?plan=trial) [Download switching manual](https://marqius.com/download/replace-wkhtmltopdf.pdf)

wkhtmltopdf (current) Marqius (drop-in)

**A simple, drop-in migration** Keep your Python workflow Install in minutes Compare your own PDFs

1

### Install

Install the compatible program alongside your current wkhtmltopdf.

```
curl -fsSL https://marqius.com/marqius-wkhtmltopdf.sh | bash
```

2

### pdfkit

If wkhtmltopdf is already on PATH, leave your code as it is. If you configured an absolute path, point it to the installed program.

```
import pdfkit
pdfkit.from_file("invoice.html", "invoice.pdf", options={"page-size": "A4"})

config = pdfkit.configuration(wkhtmltopdf="/usr/local/bin/wkhtmltopdf")
```

3

### Compare output

Render a representative document and check the PDF before switching production.

```
marqius wkhtmltopdf invoice.html new.pdf
marqius compare old.pdf new.pdf
```

**Switching manual**

Examples and troubleshooting for Python and related stacks.

[Download the manual (PDF)](https://marqius.com/download/replace-wkhtmltopdf.pdf)[Developer manual (PDF)](https://marqius.com/download/developer-manual.pdf)[Getting started guide (PDF)](https://marqius.com/download/getting-started.pdf)[14 integration examples on GitHub](https://github.com/marqius-wkhtmltopdf/marqius-wkhtmltopdf-examples)

[Start your 30-day trial](https://marqius.com/app/sign-in/?plan=trial)

PRACTICAL DETAILS

## What to check before you switch.

### Django and imgkit

Set WKHTMLTOPDF\_CMD only when the executable is outside PATH. imgkit can use the wkhtmltoimage name installed beside it.

```
WKHTMLTOPDF_CMD = "/usr/local/bin/wkhtmltopdf"

config = imgkit.config(wkhtmltoimage="/usr/local/bin/wkhtmltoimage")
```

### Check before changing production

```
marqius wkhtmltopdf invoice.html new.pdf
marqius compare old.pdf new.pdf
```

Marqius is proprietary software from Simple AI LLC. It is independent of the wkhtmltopdf project. Other product names identify the tools discussed in these guides.

QUESTIONS & ANSWERS

## Python questions

### Do I uninstall wkhtmltopdf before trying Marqius?

No. Install Marqius beside it, run a representative HTML document and compare the PDF first. Change the executable path when you are ready.

### Does it work in Flask, FastAPI and Celery jobs?

A job that launches pdfkit can point to the compatible executable in the same way as a web process. Make sure the worker environment has the program and fonts, then test its actual job.

### What if pdfkit says no executable was found?

Put the installed wkhtmltopdf-compatible executable on PATH or set its absolute path with pdfkit.configuration.

### Can django-wkhtmltopdf and imgkit use it?

They launch wkhtmltopdf or wkhtmltoimage commands. Configure the installed executable path where your deployment needs an explicit path, and test both PDF and image output.

### Will my CSS or flex layouts render the same?

Check a representative template. Marqius and the old WebKit engine can lay out some CSS differently; comparison on your documents is the safest way to decide.

Source for this page [^official-page].

[^official-page]: https://marqius.com/wkhtmltopdf/python/

[Browse this section](index.md) · [Knowledge index](../index.md)
