Update pdf.py

got RuntimeError: PDF creating failed when run ipython nbconvert --to pdf