How to use wkhtmltopdf with Docker
Asked Answered
F

1

9

When I use wkhtmltopdf (version 0.12.2.4, installed via apt-get) within a Docker container it fails with

QXcbConnection: Could not connect to display

(When I set the environment variable DISPLAY=unix0, I get QXcbConnection: Could not connect to display unix0 which makes sense as no Xserver seems to be installed)

There seems to be a headless version (source) and I thought that would mean that I don't need an Xserver.

(xvfb seems to be another option, but I'm not sure how to run it / what to install)

How can I run wkhtmltopdf in a Docker container, if I can't change the base image to openlabs/docker-wkhtmltopdf?

Fossiliferous answered 25/9, 2017 at 7:41 Comment(0)
F
3

Installing version 0.12.4 (I had 0.12.2.2 before) solved the problem. See How can I install the latest wkhtmltopdf on Ubuntu 16.04? for the steps.

Fossiliferous answered 25/9, 2017 at 8:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.