Description
Preamble
This is a tricky one to explain since it involves several systems, but I'll try my best, have included steps to reproduce and screenshots. I hope there's a simple fix because I've tried most combinations I can think of, and found no joy. I think the issue is somewhere in Jupyter's nbconvert utility, since reveal.js seems to work when I hand-carve html presentations.
The aim
Create a pdf version of a slidedeck, for printing and sharing etc
Issue
The PDF formatting is broken, and multiple slides appear on one sheet of paper, not respecting page breaks.
Background: my setup
- Basics:
python 3.5, jupyter 4.1.0, reveal.js 3.3.0, OSX 10.10.5
- Create new virtualenv using
conda env create --file test_presentation.yml
(which contains the following)
name: test_presentation
dependencies:
- python=3.5
- jupyter
- pip
Create a very basic presentation for testing
- Fire up jupyter notebooks
$> jupyter notebook
and create a slideshow using the slideshow cell toolbar with the following structure (slideshow cell toolbar indicates in parens):
# Slide 1 (This is a slide)
Freetext
# Slide 2 (this is a slide)
Freetext
## SubSlide 2a (this is a sub-slide)
Freetext
# Slide 3 (this is a slide)
Freetext
### Fragment 3a (this is a fragment)
Freetext
### Fragment 3b (this is a fragment)
Freetext
# Slide End (this is a slide)
Freetext
Convert slides and present in-browser as normal
- Use nbconvert to create slides and serve
jupyter nbconvert --to slides --post serve test_presentation.ipynb - File
test_presentation.slides.html
is created and served locally. Open it in Chrome (Version 50.0.2661.75 (64-bit) (OSX)
) - Notice the slides render as expected: and, crucially they are separated as expected, one slide per page - see screenshot (I've escape-zoomed out to show multiple slides at once)
Try to view print-pdf version and discover this formatting issue
- Add print-pdf to the end of the url
http://127.0.0.1:8000/TestPresentation.slides.html?print-pdf
- Now I find that the slides do NOT respect any page breaks nor boundaries. They appear to be smushed up together sometimes,
- Also the final slide is missing from even this smushed up version
- Naturally, when I use Chrome to print to PDF, (as described here https://github.com/hakimel/reveal.js#pdf-export) the bad formatting is preserved and printed
- I've also tried without success to locally install reveal js: encounter same issue
- Ive also tried to mess with the displayport / window size using phantom js e.g.
phantomjs reveal.js/plugin/print-pdf/print-pdf.js "http://localhost:8000/test_presentation.slides.html?print-pdf" test_presentation.pdf 1280x800
Anyone have any ideas? Thanks!