Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
707715bb
Verified
Commit
707715bb
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Let generate_pdf() start a virtual X framebuffer for electron-pdf
parent
6743559d
No related branches found
No related tags found
1 merge request
!464
Resolve "Support PDF generation via a headless Chromium running in the background using celery"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/util/pdf.py
+4
-0
4 additions, 0 deletions
aleksis/core/util/pdf.py
docs/dev/01_setup.rst
+1
-1
1 addition, 1 deletion
docs/dev/01_setup.rst
with
5 additions
and
1 deletion
aleksis/core/util/pdf.py
+
4
−
0
View file @
707715bb
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
docs/dev/01_setup.rst
+
1
−
1
View file @
707715bb
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment