jupyter / nbconvert

Jupyter Notebook Conversion
https://nbconvert.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.75k stars 569 forks source link

PDF conversion #1552

Open RalfKellner opened 3 years ago

RalfKellner commented 3 years ago

Hey everyone,

I know this question already popped up in the past, but the recommendations and answers in past posts do not really help in my case. Until today, I had no problems converting my Slides to html and save them as pdf. However, today I get a warning which does not harm the html, but makes it impossible to save as pdf properly.

The warning is as follows: NbConvertApp] Converting notebook 02_MDPs_value_functions.ipynb to slides [NbConvertApp] Writing 331840 bytes to 02_MDPs_value_functions.slides.html [NbConvertApp] Redirecting reveal.js requests to https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.5.0 Serving your slides at http://127.0.0.1:8000/02_MDPs_value_functions.slides.html Use Control-C to stop this server WARNING:tornado.access:404 GET /custom.css (127.0.0.1) 0.60ms WARNING:tornado.access:404 GET /custom.css (127.0.0.1) 0.53ms WARNING:tornado.access:404 GET /custom.css (127.0.0.1) 0.53ms WARNING:tornado.access:404 GET /custom.css (127.0.0.1) 0.50ms

As I have no clue about js and css, could you try to help me in a dummy way;)

Many thanks in advance! Ralf

RalfKellner commented 3 years ago

I really would appreciate any help, I tried it on another system and with another browser, the problem stays the same...

agoose77 commented 3 years ago

@RalfKellner can you report the following, assuming you're using pip?

pip show nbconvert

Additionally, could you share a small notebook that reproduces the issue so that we can compare results?

RalfKellner commented 3 years ago

@agoose77 sure thing: pip show nbconvert output is as follows:

Name: nbconvert Version: 5.6.1 Summary: Converting Jupyter Notebooks Home-page: https://jupyter.org Author: Jupyter Development Team Author-email: jupyter@googlegroups.com License: BSD Location: /Users/ralfkellner/opt/anaconda3/lib/python3.8/site-packages Requires: pandocfilters, nbformat, pygments, mistune, defusedxml, traitlets, entrypoints, testpath, jupyter-core, bleach, jinja2 Required-by: spyder, notebook, myst-nb, jupyter, jupyter-sphinx, jupyter-latex-envs, jupyter-contrib-nbextensions, jupyter-book, hide-code

and a short example which leads to the warning is here:

https://github.com/RalfKellner/github-slideshow/blob/main/slideshow.ipynb

What I do to convert is: jupyter nbconvert --to slides slideshow.ipynb --post serve

and just to clarify it: The cells are Slides using the RISE extension

agoose77 commented 3 years ago

How do you save them to PDF once you've generated the slides? As an aside, the newer version of nbconvert doesn't have this warning.

RalfKellner commented 3 years ago

Alright, I currently installed the new version and it works. Now I only get the error when saving it as pdf.

I do so as explained here: https://rise.readthedocs.io/en/stable/exportpdf.html

So by adding the ?pdf-print ending.

When I do this the warning appears once more. Nevertheless, it works, however, the format is a little messed up.

By the way I tried the current version of nbconvert yesterday and conversion failed due to template errors...

agoose77 commented 3 years ago

Could you share a screenshot? It seems to work fine for me. What browser do you use?

RalfKellner commented 3 years ago

01_Introduction slides_not_working.pdf 01_Introduction.pdf

The first file is how it looks now, the second file is how it looked when it was working fine. I am using Firefox and I also tried it with Chrome. Behavior was the same.