minetest_modding_book/utils/convert_to_pdf.sh

26 lines
590 B
Bash
Raw Normal View History

2017-08-26 19:26:08 +03:00
---
---
#!/bin/sh
oldCWD="$PWD"
cd $(dirname $0)
cd ../en/
#wkhtmltopdf --print-media-type {% for link in site.data.links_en %}{% if link.link %}{{ link.link }} {% endif %}{% endfor %} out.pdf
#mv out.pdf $oldCWD/book.pdf
{% for link in site.data.links_en %}
{% if link.link %}
/opt/google/chrome/google-chrome --headless --disable-gpu --print-to-pdf file:///${PWD}/{{ link.link }}
{% if link.num %}
mv output.pdf page_{{ link.num }}.pdf
{% else %}
mv output.pdf page_0_{{ link.link | replace:".","_" }}.pdf
{% endif %}
{% endif %}
{% endfor %}
pdfunite page*.pdf ${oldCWD}/book.pdf