Skip to content

Printing slides seems to have broken page formatting (nbconvert then ?print-pdf) #1368

Open
@jonsedar

Description

@jonsedar

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

  1. Basics: python 3.5, jupyter 4.1.0, reveal.js 3.3.0, OSX 10.10.5
  2. 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

  1. 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

  1. Use nbconvert to create slides and serve
    jupyter nbconvert --to slides --post serve test_presentation.ipynb
  2. File test_presentation.slides.html is created and served locally. Open it in Chrome (Version 50.0.2661.75 (64-bit) (OSX))
  3. 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)

test_presentation_slidesinbrowser

Try to view print-pdf version and discover this formatting issue

  1. Add print-pdf to the end of the url http://127.0.0.1:8000/TestPresentation.slides.html?print-pdf
  2. Now I find that the slides do NOT respect any page breaks nor boundaries. They appear to be smushed up together sometimes,
  3. Also the final slide is missing from even this smushed up version
  4. 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
  5. I've also tried without success to locally install reveal js: encounter same issue
  6. 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

test_presentation_printpdfissue

Anyone have any ideas? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions