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
As of now there's not a programming language API to convert notebooks to PDF. However, a command line utility exists called nbconvert. It has the same functionality as the web interface's format converters. To convert to PDF, you can do jupyter nbconvert notebook.ipynb --to pdf
.
Luckily, Python has a handy subprocess module which allows you to spawn new processes, check their inputs and outputs, and get their return codes. So you could do something like:
import subprocess
subprocess.call("jupyter nbconvert notebook.ipynb --to pdf")
Kind of a hacky way, but it will work. If you're using Windows, you may need to add the additional kwarg shell=True
to subprocess.call()