-
-
Save wizofe/0f6df2c3a3a2746c77c2e768aedee873 to your computer and use it in GitHub Desktop.
Convert python files to pdf and concatenate all pdfs. Requires pygmentize, pdflatex and pdftk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
allpdfs="" | |
for f in "$@" ; do | |
filename=$(basename "$f") | |
filename="${filename%.*}" | |
pygmentize -f tex -O linenos -O title=$( echo $filename | tr '_' '-').py -O full -O style=default -o /tmp/$filename.tex $f | |
pdflatex -jobname=$filename -output-directory=/tmp /tmp/$filename.tex | |
allpdfs="$allpdfs /tmp/$filename.pdf" | |
done | |
pdftk $allpdfs cat output /tmp/combined.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment