I have a little program that basically does all kinds of statistical calculation and prints out results and charts.
At present, a convenient way to get a nice pdf output
If you have an IPython notebook, you can make a small python or bash script that first executes and then produces the PDF. For me, this bash script works:
jupyter nbconvert --ExecutePreprocessor.timeout=500 --to notebook --execute my_file.ipynb
jupyter nbconvert --to pdf my_file.nbconvert.ipynb
rm my_file.nbconvert.ipynb
If you want to customise the output using a template, I have found that converting the file first to markdown and then using pandoc to create a PDF avoids some issues:
jupyter nbconvert --ExecutePreprocessor.timeout=500 --to notebook --execute my_file.ipynb
jupyter nbconvert --to markdown my_file.nbconvert.ipynb --template="mytemplate.tpl"
pandoc --toc --template=mytemplate.tex markdown my_file.nbconvert.ipynb --latex-engine=pdflatex -o final file.pdf