# A wkhtmltopdf alternative: headless Chromium over an API

> A migration guide that maps common wkhtmltopdf command-line options to a headless Chromium PDF API and shows the same job as cURL, Node and Python code.

wkhtmltopdf's own status page and repository tell you where the project stands. This guide maps its common options to a headless Chromium PDF API and shows the same job as code you can run.

## Key facts

- wkhtmltopdf's GitHub repository shows it archived by the owner on Jan 2, 2023 and read-only; its status page says QtWebKit was deprecated in 2015 and removed in 2016 (checked 2026-10-09).
- The API renders with headless Chromium, so current CSS such as flexbox and grid and your page's JavaScript are supported.
- Print styles are the default here, while wkhtmltopdf uses screen styles unless asked; send media screen to keep the old behaviour.

## Choosing a wkhtmltopdf alternative

There are three ways to replace wkhtmltopdf. Pick the one that matches how much control you need and how much you want to run yourself.

- Run headless Chromium yourself with Playwright or Puppeteer. You control the browser, fonts and timeouts, and you look after them too.
- Use a hosted API such as this one. Each job runs headless Chromium in a fresh browser context inside a resource-limited worker container, with a hard timeout.
- Use another hosted PDF API, such as DocRaptor. It also runs JavaScript and works asynchronously, so compare the details that matter to you.

## Is wkhtmltopdf safe to use?

The project's own status page answers part of this. It says the engine it uses, Qt WebKit, was deprecated in 2015 and removed in 2016. It also advises against using wkhtmltopdf with untrusted HTML (wkhtmltopdf.org/status.html, checked 2026-10-09).

If your application renders HTML from users, that advice applies to you. Moving to headless Chromium also means leaving the archived wkhtmltopdf project.

## Migration steps

Move one template at a time. Small steps make differences easier to trace.

- List the wkhtmltopdf options your scripts use, and map each one with the option mapping table above.
- Render one real template through both tools and save the two PDFs side by side.
- Compare page breaks, margins, fonts and images. Fix layout differences in your CSS first.
- Test large HTML through the API. The free web tool accepts up to 256 KB of HTML per conversion.
- Send the same HTML as a job, then poll GET /v1/jobs/{id} until the status is succeeded and download the file.
- When the output matches what you need, change your code and remove the old command.

## What changes when you switch

Some defaults are different. Check these before you compare results.

- PDFs use print styles by default. Set media to screen if your page should print as it looks on screen.
- The page is printed as A4 with the default margin on all sides, unless you set format or margin.
- JavaScript runs by default. For pages that build themselves after load, use wait_until, wait_for_selector or delay_ms.
- Each job gets a fresh browser context, so cookies and cache are not shared between jobs. Send headers with the request when a site needs them.
- Credits for failed and timed-out jobs are returned, and jobs are asynchronous, so your code should poll for the result.

## Running headless Chromium yourself

Self-hosting is a valid choice if your documents must stay on your own machines. The engine behind this service is the same kind of tool: headless Chromium driven by Playwright.

A self-hosted setup needs your own timeout for each job, your own clean-up of temporary files, and the fonts you install.

## Where a wkhtmltopdf replacement fits in your code

A wkhtmltopdf replacement changes how your code runs more than it changes your HTML. Instead of calling a local binary, your code sends one POST request to /v1/render and then checks the job until the PDF is ready.

If you searched for wkhtmltopdf chromium, you want a newer engine for the same kind of PDF. This API prints with Chromium, not Qt WebKit. Templates still need a check, as covered above, because fonts and print styles can differ.

## Python HTML to PDF without wkhtmltopdf

Python wrappers such as pdfkit call the wkhtmltopdf program under the hood. To do python html to pdf without wkhtmltopdf, send the HTML to the API with an HTTP library: POST it to /v1/render with output set to pdf, poll the job, then download the file from download_url.

## Questions

### Is wkhtmltopdf still maintained?

Its GitHub repository was archived by the owner on 2 January 2023 and is read-only (checked 2026-10-09 on github.com/wkhtmltopdf/wkhtmltopdf). Its status page also says it uses Qt WebKit, which was deprecated in 2015 and removed in 2016, and advises against using it with untrusted HTML (wkhtmltopdf.org/status.html, checked 2026-10-09).

### Will my existing HTML render the same?

Not necessarily. The rendering engine is different, so layouts can shift. Run your real templates through both and compare before you switch, and fix differences in your CSS.

### How do I convert a local HTML file with relative images and CSS?

The API loads public http and https addresses only, not files on your machine. Inline images and styles with data URLs, point them at absolute https URLs, or send base_url so relative paths resolve against a public site.

### Are my fonts available?

Fonts installed on your own server are not on ours. The render server has the Noto and Liberation font families and colour emoji. For other fonts, load them with @font-face from a public URL or a data URL.

### Do I have to send my HTML to a third party?

With the API, yes: the HTML is sent to our servers and deleted after the retention period of your plan. If that is not acceptable for your documents, running headless Chromium yourself is the alternative.

### How do page numbers work?

Pass footer_template HTML containing spans with the classes pageNumber and totalPages, set display_header_footer to true and leave room in the top and bottom margins.

### Is wkhtmltopdf safe?

The project's status page advises against using wkhtmltopdf with untrusted HTML. It also says its engine, Qt WebKit, was removed in 2016 (wkhtmltopdf.org/status.html, checked 2026-10-09). If you render HTML from other people, move to a current engine.

### Can I use Puppeteer or Playwright myself instead?

Yes. You can run headless Chromium yourself with Puppeteer or Playwright. You then control the browser and where it runs, and you handle timeouts, clean-up and fonts yourself. The API takes that work off your hands.

### How do I keep the same margins and page size?

Keep format set to A4, which is the default, or set it to the size you used before. Set margin on each side to the values from your old command. print_background is on by default, so backgrounds print unless you turn it off. Check the option mapping table above for the rest.

### Is wkhtmltopdf deprecated?

The project is archived. Its GitHub repository was archived by the owner on 2 January 2023 and is read-only (source: github.com/wkhtmltopdf/wkhtmltopdf, checked 2026-10-09). Its status page says the engine it uses, Qt WebKit, was deprecated in 2015 and removed in 2016 (source: wkhtmltopdf.org/status.html, checked 2026-10-09).

## Related

- [PDF generator API](https://aiipworld.com/pdf-api/index.md)
- [HTML to PDF converter](https://aiipworld.com/tools/html-to-pdf/index.md)
- [URL to PDF](https://aiipworld.com/tools/url-to-pdf/index.md)
- [AIIPWorld as a DocRaptor alternative](https://aiipworld.com/alternatives/docraptor/index.md)
- [Print CSS for PDF: a practical guide](https://aiipworld.com/guides/print-css-for-pdf/index.md)
- [HTML to PDF Python: a requests guide](https://aiipworld.com/guides/html-to-pdf-python/index.md)
- [HTML to PDF nodejs: a Node.js API guide](https://aiipworld.com/guides/html-to-pdf-nodejs/index.md)

Page: https://aiipworld.com/guides/wkhtmltopdf-alternative/
