Skip to content

Commit ad8c0a4

Browse files
author
dphuang2
committed
use weasyprint
1 parent 71feceb commit ad8c0a4

File tree

5 files changed

+179
-1134
lines changed

5 files changed

+179
-1134
lines changed

.github/workflows/create-pdf.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,26 @@ jobs:
1818
mkdir output
1919
cp resume-stylesheet.css output/resume-stylesheet.css
2020
cp resume.md output/${{ github.actor }}-resume.md
21-
# Downloading the binaries directly, because they are newer and work better, than the ones that come with Ubuntu latest.
22-
- name: "Install pandoc and wkhtmltopdf"
21+
# Install pandoc and weasyprint
22+
- name: "Install pandoc and weasyprint"
2323
working-directory: markdown-resume
2424
run: |
2525
wget https://github.com/jgm/pandoc/releases/download/3.0.1/pandoc-3.0.1-1-amd64.deb
26-
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
2726
sudo apt install ./pandoc-3.0.1-1-amd64.deb
28-
sudo apt install ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb
27+
sudo apt-get update
28+
sudo apt-get install -y python3-pip
29+
pip3 install weasyprint
2930
3031
- name: "Convert MD to HTML"
3132
working-directory: markdown-resume
3233
run: |
3334
pandoc resume.md -f markdown -t html -c resume-stylesheet.css -s -o output/${{github.actor}}-resume.html
3435
35-
- name: "Convert HTML to PDF "
36+
- name: "Convert HTML to PDF"
3637
working-directory: markdown-resume
37-
run: "wkhtmltopdf --enable-local-file-access output/${{github.actor}}-resume.html output/${{github.actor}}-resume.pdf"
38-
# run: |
39-
# /usr/bin/pandoc -standalone --output=output/resume.pdf --css=resume-stylesheet.css --from=markdown --to=pdf --pdf-engine=/usr/bin/wkhtmltopdf resume.md
38+
run: |
39+
weasyprint output/${{github.actor}}-resume.html output/${{github.actor}}-resume.pdf
40+
4041
- uses: actions/upload-artifact@master
4142
with: # basically this will put resume.md, resume.html, resume.pdf and resume-stylesheet.css in a zip file.
4243
name: ${{ github.actor }}'s Resume

markdown-resume/generate-pdf.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
#!/bin/sh
22

3-
pandoc resume.md -f markdown -t pdf --pdf-engine=wkhtmltopdf -c resume-stylesheet.css -s -o resume.pdf
3+
# Generate HTML first
4+
pandoc resume.md -f markdown -t html -c resume-stylesheet.css -s -o resume.html
5+
# Use weasyprint to convert HTML to PDF
6+
weasyprint resume.html resume.pdf

0 commit comments

Comments
 (0)