diff --git a/aleksis/core/util/pdf.py b/aleksis/core/util/pdf.py
index bd4a5a15277ea9f6cd815c1b073c6ddef088d8c5..af6705999dbe2580daaeced37b1f6cba500ee835 100644
--- a/aleksis/core/util/pdf.py
+++ b/aleksis/core/util/pdf.py
@@ -35,7 +35,11 @@ def generate_pdf(recorder: Union[ProgressRecorder, DummyRecorder], html_code: st
     with open(path, "w") as f:
         f.write(html_code)
 
+    # Start a X framebuffer and run electron-pdf
+    os.environ["DISPLAY"] = ":99.0"
+    xfvb_process= subprocess.Popen(["Xvfb", ":99", "-screen", "0", "1024x768x24"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
     subprocess.run(["electron-pdf", path, pdf_path])  # noqa
+    xfvb_process.terminate()
 
     os.remove(path)
 
diff --git a/docs/dev/01_setup.rst b/docs/dev/01_setup.rst
index 0e6d44b0c7b0cbaecb675eb160d7aed09f9472b0..f78550b4feef883906990e561f32883a546397fb 100644
--- a/docs/dev/01_setup.rst
+++ b/docs/dev/01_setup.rst
@@ -28,7 +28,7 @@ Install native dependencies
 
 Some system libraries are required to install AlekSIS::
 
-  sudo apt install build-essential libpq-dev libpq5 libssl-dev python3-dev python3-pip python3-venv yarnpkg gettext
+  sudo apt install build-essential libpq-dev libpq5 libssl-dev python3-dev python3-pip python3-venv yarnpkg gettext xvfb
 
 If you want to use the PDF rendering feature, you have to install ``electron-pdf``
 according to the instructions at https://github.com/fraserxu/electron-pdf.