Skip to content
Snippets Groups Projects
Verified Commit 8e0e5b6f authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Test electron-pdf with xfvb-run in Docker image

parent e299f045
No related branches found
No related tags found
1 merge request!464Resolve "Support PDF generation via a headless Chromium running in the background using celery"
......@@ -31,7 +31,9 @@ RUN apt-get -y update && \
libpq-dev \
libssl-dev \
postgresql-client \
yarnpkg && \
yarnpkg \
xvfb && \
eatmydata yarnpkg global add electron-pdf && \
eatmydata pip install uwsgi
# Install extra dependencies
......
......@@ -30,14 +30,7 @@ def generate_pdf(html_code: str, pdf_path: str, recorder: ProgressRecorder):
f.write(html_code)
# Start a X framebuffer and run electron-pdf
os.environ["DISPLAY"] = ":99.0"
xfvb_process = subprocess.Popen( # noqa
["Xvfb", ":99", "-screen", "0", "1024x768x24"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
subprocess.run(["electron-pdf", path, pdf_path]) # noqa
xfvb_process.terminate()
subprocess.run(["xvfb-run", "-a", "electron-pdf", path, pdf_path]) # noqa
recorder.set_progress(1, 1)
......
......@@ -30,8 +30,9 @@ 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 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.
Additionally, you have to install ``electron-pdf`` for the PDF rendering feature using ``npm``::
sudo yarn global add electron-pdf
Get Poetry
----------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment