Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to convert Jupyter Notebook to PDF slides

I'm trying to convert a Jupyter notebook that is using RISE to visualize the slides as a slideshow in the browser into a PDF file. The PDF file should have all pages in landscape mode and resemble the view in the browser. Of course, animations are not possible, but it should be possible to have fragments either combined in a single PDF slide or spread across multiple sort of "accumulating" slides (i.e. building upon their forerunner slides) .

I've been trying to create my own Jinja template that generates a LaTeX document utilizing the beamer document class, with not much success so far.

Do you know if there are any tools or templates or exporters or anything available that can help me with this process? Preferably automatically, like, utilizing nbconvert?

like image 319
Hendrik Wiese Avatar asked Oct 22 '18 07:10

Hendrik Wiese


1 Answers

Figured it out myself. Take these steps:

  1. launch jupyter nbconvert --to slides --post serve the_notebook.ipynb; the browser will open the node hosted the_notebook.slides.html
  2. replace the # after the the_notebook.slides.html in the browser URL with ?print-pdf so that the url looks most likely like http://127.0.0.1:8000/the_notebook.slides.html?print-pdf
  3. print to PDF file
like image 98
Hendrik Wiese Avatar answered Oct 24 '22 10:10

Hendrik Wiese