forked from diggersheep/GenieLogiciel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-pdf.sh
executable file
·27 lines (24 loc) · 1020 Bytes
/
build-pdf.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
exportdir=$1
projectname=$2
# we have to wait 'a few seconds' for current version of gh-pages to show up
# ... kind of ugly tho'
sleep 30s
# get the latest version of wkhtmltopdf and untar it
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
echo "Generating PDF ..."
generate_pdf()
{
./wkhtmltox/bin/wkhtmltopdf --enable-internal-links --enable-external-links https://wiztigers.github.io/${projectname}/ ${exportdir}/${projectname}.pdf
}
# /!\ wkhtml currently exits on error if there are relative links in the html.
# However, pdf is generated despite this error status.
# So for now I'll just consider it a success if the output file exists at all.
# ( @see https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2051 )
! generate_pdf
rm -rf wkhtmltox*
if [ ! -f ${exportdir}/${projectname}.pdf ]; then
echo ERROR: ${exportdir}/${projectname}.pdf not generated !
exit 1
fi