---
type: Article
title: "wkhtmltopdf to Puppeteer: check these three things first | Marqius"
description: Chrome prints page numbers. It has no table of contents, and its
  footer runs no script. Each point is shown with one small example.
resource: https://marqius.com/blog/wkhtmltopdf-to-puppeteer/
tags:
  - marqius
  - journal
status: stable
sources:
  - id: official-page
    resource: https://marqius.com/blog/wkhtmltopdf-to-puppeteer/
    last_modified: 2026-11-23T13:15:08.868Z
generated:
  by: process:marqius-site-build
  at: 2026-11-23T13:15:59.953Z
x_marqius:
  language: en
  source_sha256: 674921ff27146dd4a6ae6298f07dac0e197e20a8a341b11919d5e2d01cc6f963
  extraction: public-main-content
---

wkhtmltopdf migration

# Moving from wkhtmltopdf to Chrome? Check these three things first

Your app makes PDFs with wkhtmltopdf. wkhtmltopdf is a small program. Your app starts it, hands it an HTML page, and gets a PDF back.

Marqius November 23, 2026

New versions of Ubuntu and Debian no longer include it. So you may want to use Chrome to make your PDFs instead.

You can. But check three things first. If your PDF needs one of them, Chrome will not do it for you:

1.  **A table of contents.** That is the page at the start that lists the chapters and their page numbers.
2.  **A script in the footer.** The footer is the line at the bottom of each page. Some apps use a script there, for example to leave it off the cover page.
3.  **A library such as wicked\_pdf or PDFKit.** It cannot start Chrome. It only knows how to start wkhtmltopdf.

Page numbers are not a problem. Chrome can print them. So can wkhtmltopdf.

## What to do

Open a PDF your app makes today.

-   It has no table of contents and no script in the footer. Chrome will do the job.
-   It has one of them. Keep your command, and change only the program.

Marqius is such a program. It understands everything wkhtmltopdf does. It also installs where the old one no longer does: Ubuntu 26.04, Debian 13, Alpine and the test machines GitHub gives its users, which are called `ubuntu-latest`. [How to install it](https://marqius.com/blog/wkhtmltopdf-no-installation-candidate/)

## The whole list

| 
What your PDF has

 | 

Chrome

 | 

wkhtmltopdf or Marqius

 |
| --- | --- | --- |
| 

Page numbers

 | 

yes, with a footer template

 | 

`--footer-center "Page [page] of [topage]"`

 |
| 

Bookmarks

 | 

yes, with `outline: true`

 | 

yes, by default

 |
| 

A table of contents

 | 

no

 | 

`toc`

 |
| 

A script in the footer

 | 

no

 | 

a script in `footer.html`

 |
| 

wicked\_pdf, PDFKit, python-pdfkit or Snappy

 | 

new code needed

 | 

nothing changes

 |

Bookmarks are the chapter names in the side panel of a PDF reader. Click one to jump to that chapter.

## One example, used on this page

The example is a three-page document. Each page is a small HTML file:

html

```
<!-- cover.html -->     <h1>Acme GmbH</h1> <p>Terms and conditions, 2026</p>
<!-- chapter1.html -->  <h1>1. Payment</h1> <p>Pay in 30 days.</p>
<!-- chapter2.html -->  <h1>2. Delivery</h1> <p>We deliver in five working days.</p>
```

One command puts them together:

bash

```
marqius-wkhtmltopdf cover.html chapter1.html chapter2.html report.pdf
```

The result has three pages. Each file starts on a new page:

Code

```
Page 1: Acme GmbH, Terms and conditions, 2026
Page 2: 1. Payment, Pay in 30 days.
Page 3: 2. Delivery, We deliver in five working days.
```

Every test on this page ran on 23 November 2026, in Chrome 158 and in Marqius 0.12.13. Puppeteer 25.18.1 started Chrome. Puppeteer is a library that starts Chrome for your code.

## 1\. Page numbers: both can do it

**wkhtmltopdf or Marqius.** Add one option:

bash

```
marqius-wkhtmltopdf --footer-center "Page [page] of [topage]" cover.html chapter1.html chapter2.html report.pdf
```

`[page]` turns into the page number. `[topage]` turns into the number of pages. The bottom of the three pages reads:

Code

```
Page 1 of 3
Page 2 of 3
Page 3 of 3
```

**Chrome.** You write a footer template. That is a small piece of HTML that Chrome puts at the bottom of every page. You hand it to Puppeteer:

js

```
await page.pdf({
  displayHeaderFooter: true,
  footerTemplate: '<div style="font-size:10px;text-align:center;width:100%"><span class="pageNumber"></span> of <span class="totalPages"></span></div>',
  margin: { bottom: '25mm' },
});
```

`pageNumber` and `totalPages` are two names. Chrome fills them in. The bottom of the three pages reads:

Code

```
1 of 3
2 of 3
3 of 3
```

So page numbers work in both. The difference is the work. Your old command already has its footer. In Chrome you write it again.

## 2\. Table of contents: Chrome has none

A table of contents is the page at the start of a book. It lists the chapters and the page where each one starts.

**wkhtmltopdf or Marqius.** Add one word, `toc`:

bash

```
marqius-wkhtmltopdf toc cover.html chapter1.html chapter2.html report.pdf
```

The PDF now has four pages. The first page is the table of contents:

Code

```
Table of Contents
Table of Contents     1
Acme GmbH             2
1. Payment            3
2. Delivery           4
```

The second line is the contents page itself. wkhtmltopdf lists it too.

**Chrome.** There is no option for it. To get one, your code must cut the document into pages, find the page number of each heading, and build the page. That is a small project, not a setting.

## 3\. A script in the footer: Chrome does not run it

A footer can show more than a page number. Here it shows today's date.

**wkhtmltopdf or Marqius.** The footer is a file of your own, `footer.html`. A script in that file runs:

html

```
<div>Acme GmbH · <span id="today"></span></div>
<script>
  document.getElementById("today").textContent = "Printed on " + new Date().toISOString().slice(0, 10);
</script>
```

bash

```
marqius-wkhtmltopdf --footer-html footer.html --margin-bottom 20 cover.html chapter1.html chapter2.html report.pdf
```

`--margin-bottom 20` leaves 20 mm of space at the bottom for the footer. The bottom of every page reads:

Code

```
Acme GmbH · Printed on 2026-11-23
```

Teams use this for more. A footer that is left off the cover page. A header that shows the name of the chapter.

**Chrome.** Put the same script in the footer template. Nothing happens. Tested: the date never appeared. The line stayed “Acme GmbH ·”.

## 4\. Your library: it only knows wkhtmltopdf

wicked\_pdf, PDFKit, python-pdfkit and Snappy do not make PDFs by themselves. They start the wkhtmltopdf program for you. They have one setting for it: where the program is. They have no setting for Chrome.

So “switch to Chrome” always means new code. You write a new step that starts Chrome. Then you set every option again.

With Marqius, the old setting keeps working. Run `marqius-wkhtmltopdf install` once. After that, these libraries find Marqius under the name `wkhtmltopdf`. Your code does not change.

## One thing to avoid

On Ubuntu 24.04, `apt install wkhtmltopdf` still works. But that copy has a limit. It leaves out footers and tables of contents, and prints this line:

Code

```
The switch --footer-center, is not support using unpatched qt, and will be ignored.
```

## Check it on your own PDFs

Make the same PDF twice. Once with your app today. Once with Marqius. Then compare them:

bash

```
marqius-wkhtmltopdf compare old.pdf new.pdf
```

It gives a verdict, which means it says whether the two PDFs are the same. Then it lists each difference with its page and its kind: text, number, date, page break, font, spacing.

## Questions

### Can Puppeteer make a table of contents?

No. It has no option for one. Your code has to build the page.

### Does the footer in Chrome run JavaScript?

No. A script in the footer template does not run. CSS can print page numbers in the footer. It cannot read your data.

### Does the footer template in Chrome use my CSS?

No. Write its styles inside the template.

### Can wicked\_pdf or Snappy use Chrome?

No. They start the `wkhtmltopdf` program. They cannot start Chrome.

### Is Chrome a bad choice?

No. It is the right tool for a report that needs a browser: one that loads its data or draws a chart after the page opens. A document that wkhtmltopdf prints well today needs no browser.

### What does it cost?

There are two licences. The Community licence is free: for personal projects, for teaching and learning, and for open-source projects, including their CI test runs and documentation builds. The commercial licence is for businesses. [Plans and licences](https://marqius.com/wkhtmltopdf-buy/)

### Who makes it?

Marqius is commercial software from Simple AI LLC. It is independent of the wkhtmltopdf project, of Puppeteer and of Chrome.

## What one team found

ERPNext is a business software package. It is built on Frappe. Version 17 of Frappe stopped using wkhtmltopdf and moved to Chrome. Its users then reported two problems:

-   A footer that showed only on pages 2 and 3 of a five-page document. The same document made with wkhtmltopdf had the footer on every page.
-   Big reports that ran out of memory on small servers. “The same report was fine” on the two versions before. Frappe's fix, from 26 October 2026, makes big reports with a different tool.

This is one team's experience. It is not a test of every server.

## Where this comes from

-   Puppeteer's PDF options, version 25.18.1: [https://pptr.dev/api/puppeteer.pdfoptions](https://pptr.dev/api/puppeteer.pdfoptions)
-   Three wishes in Puppeteer's list: a table of contents (86 reactions, closed), scripts in the header and footer (66 reactions, open), and the page's own styles in the template (103 reactions, closed as “not planned”): [https://github.com/puppeteer/puppeteer/issues/1778](https://github.com/puppeteer/puppeteer/issues/1778), [https://github.com/puppeteer/puppeteer/issues/2167](https://github.com/puppeteer/puppeteer/issues/2167) and [https://github.com/puppeteer/puppeteer/issues/1853](https://github.com/puppeteer/puppeteer/issues/1853)
-   Chrome 131 and later can also put a footer in plain CSS, and leave it off the first page: [https://developer.chrome.com/blog/print-margins](https://developer.chrome.com/blog/print-margins)
-   The Frappe reports: [https://github.com/frappe/frappe/issues/41443](https://github.com/frappe/frappe/issues/41443) and [https://github.com/frappe/frappe/issues/44757](https://github.com/frappe/frappe/issues/44757)
-   The Frappe change: [https://github.com/frappe/frappe/pull/45208](https://github.com/frappe/frappe/pull/45208)

## Keep reading

[wkhtmltopdf: libssl.so.1.1: cannot open shared object file](https://marqius.com/blog/wkhtmltopdf-libssl-so-1-1/) [Package 'wkhtmltopdf' has no installation candidate](https://marqius.com/blog/wkhtmltopdf-no-installation-candidate/) [Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04…](https://marqius.com/blog/wkhtmltopdf-binary-invalid-platform/) [All journal guides](https://marqius.com/blog/)

Source for this page [^official-page].

[^official-page]: https://marqius.com/blog/wkhtmltopdf-to-puppeteer/

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