Posts

Showing posts from February, 2019

Render Jupyter Notebook to HTML or PDF

The following shows how to render a  Jupyter Notebook  into a static form, such as HTML or PDF document.  Render to HTML To render a Jupyter Notebook to HTML: jupyter nbconvert --exec --to html --output document.html document.ipynb You can also specify an output directory: jupyter nbconvert --exec --to html --output document.html --output-dir target document.ipynb The HTML has all images embedded. This makes sharing easy is the HTML is fully self contained. Render to PDF I have had mixed results converting a notebook directly to PDF. The conversion complained that embedded images were not found. Instead I suggest first converting it to LaTeX and then to a PDF. To convert to Tex run: jupyter nbconvert --exec --to latex --output document.tex document.ipynb Now, it is an easy matter to convert TeX to PDF with pdflatex : pdflatex document.tex Build using Makefile A generic Makefile that can be used in a Jupyter project to perform ...