Skip to content

Commit

Permalink
Update MarkdownToPDF generation
Browse files Browse the repository at this point in the history
  • Loading branch information
martinweismann committed Mar 8, 2019
1 parent 47a7607 commit 8eaef0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion markdownToPDF/install_wkhtmltopdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar vxf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
cp wkhtmltox/bin/wkhtmltopdf .
chmod a+x wkhtmltopdf
chmod a+x wkhtmltopdf
8 changes: 7 additions & 1 deletion markdownToPDF/mdToPDF.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

#!/bin/bash

mkdir ~/.grip
echo "PASSWORD = '${GITHUB_API_KEY}'" > ~/.grip/settings.py

FILE="$1"
TMPFILE="temp.html"

Expand All @@ -34,9 +37,12 @@ sed -i 's|<a href="images/3mf_logo_50px.png"|<a|g' "$TMPFILE"
sed -i 's|<a href="#|<a href="@|g' "$TMPFILE"
sed -i 's|href="#|name="|g' "$TMPFILE"
sed -i 's|<a href="@|<a href="#|g' "$TMPFILE"
sed -i 's|<pre|<code style="white-space: pre-wrap; page-break-inside: avoid !important; display: block;"|g' "$TMPFILE"
sed -i 's|</pre|</code|g' "$TMPFILE"
sed -i "/Page tweaks/ a * { font-size: large; }" "$TMPFILE"

MARGIN=14

./wkhtmltopdf --title "$FILE" --footer-left "[section]" --footer-right "[page]/[topage]" --footer-font-size 7 --footer-spacing 4 \
--margin-top $MARGIN --margin-left $MARGIN --margin-right $MARGIN --margin-bottom $MARGIN \
"$TMPFILE" "$FILE.pdf"
"$TMPFILE" "$FILE.pdf"

0 comments on commit 8eaef0e

Please sign in to comment.