Downloading jupyter notebook as pdf wont stop loading
I found this post on github where someone had the same issue and fixed it but I do not understand what it means to and how to set a path variable.
I have a start up file but am scared to mess with it. Does the path variable need to be specific for jupyter notebook outputs?!? The text was updated successfully, but these errors were encountered:.
Thanks for your question. As a first note this is IPython, not jupyter notebook, the difference is complicated, so let's gloss over it. Are you using conda? If you are using conda than you should be able to "conda install pandoc", it will be wayyyy easier. When you type a command in bash, like "jupyter", or "python" or "pandoc", linux need to know where to "search" for things.
It will search in each of these folder in order , and stop on the first where it finds the command you asked. Oh no, i've messed up my path What is better is to append, or prepend to path depending of wether you want things to have high prepend , or low append precedence. You will even probably have in this file already some stuff, for example I have that added by conda :. You might need to restart your jupyter notebook server for things to work, but if PATH is set correctly, and in bash you get something along:.
Side notes: if you are on linux you like can apt install pandoc one almost never download and install a an app by downloading it manually on linux. If you wonder "where" a command like pandoc, jupyter, python is on linux, you can use which , to tell you where things are:.
This might help you to figure things out better, if not we can try to dig in more details. Sorry, something went wrong. There is a related Github issue. Next, if you aren't using Anaconda or haven't already, you must install pandoc either by following the instructions on their website or, on Linux, as follows:.
You can now navigate to the folder that holds your IPython Notebook and run the following command:. As the comments to the question say, you will need pandoc and latex e. I installed pandoc with Homebrew, it took just a second. Having pandoc and TeXShop, I could generate latex but not pdf on the command line. Exploring the latex. After installing all of these adjustbox. However, the result looks a little too funky for my taste. It is too bad that printing the html from Safari loses the syntax coloring.
Otherwise, it doesn't look so bad. This is all on OS X. After execution of these commands, close the opened notebooks refresh the home page Or restart the kernel of the opened notebook. Now try to download notebook as a pdf :. The approach with wkhtmltopdf is the only approach I found works well and provides high quality pdfs. Other approaches described here are problematic, syntax highlighting does not work or graphs are messed up. If the above steps doesn't generate full PDF of the Jupyter notebook probably because Chrome, some times, don't print all the outputs because Jupyter make a scroll for big outputs ,.
In your Jupyter Notebook, click Cell on top of the jupyter notebook. After a frantic set of searches and trials, both of them were solved. This requires both tex and pandoc ; both jumbo external programs cannot installed by Python's pip. This should take nearly an hour to complete in the usual case. If the problem persists, you might have to install MacTeX distro. For Ubuntu: install vanilla TeXLive from the network installer -- not through apt-get. Then install pandoc using apt-get.
I had all kinds of problems figuring this out as well. I don't know if it will provide exactly what you need, but I downloaded my notebook as an HTML file, then pulled it up in my Chrome browser, and then printed it as a PDF file, which I saved. It captured all my code, text and graphs. It was good enough for what I needed.
Screenshot Convert ipynb to pdf. If it dosn't work for any reason, you can try another way. As a brand new member, I was unable to simply add a comment on the post but I want to second that the solution offered by Phillip Schwartz worked for me.
Hopefully people in a similar situation will try that path sooner with the emphasis. Not having page breaks was a frustrating problem for quite a while so I am grateful for the discussion above. Another note: an additional benefit of this method is that is automatically handles text wrapping.
Updated to prefer Print Preview rather than saving to. The latter may have issues embedding external images, but not the former. However, some funny thing showed up, the image doesn't belong where they're supposed to be. Like, the picture I insert in the first markdown cell shows up in the next md cell or somewhere strange.
I don't quite know about latex, so I haven't consider manually edit the tex file, I wonder if there is any easy solution? Ultimately, I think that issue is worth a bug report of it's own. I'll working on submitting some of my fixes some one of my other repos back to nbconvert and this will be one of them. TeXworks will not find any embedded.
What I did not get from the current discussion:. I use the export on a large number of lecture scripts and have some sed-based postprocessing of the LaTeX files, so I would really appreciate some way to export the file information into the tex file even if it were commented out, then I could include it myself via sed.
SebastianSager re 1 we got image export working using matplotlib image. All the comments by mpacer and kangwonlee are spot on and were very helpful. I'm just adding this example because I missed those on my first pass. I'm hoping this will help somebody in the future if they are scanning this issue.
Some of theses issues are a real pain to fix in nbconvert. I'm planning to get some fixes in for the 6. In my experience, classical file system approaches with the "file path based locating" algorithm will become more and more a problem. But alternatives a on the rise Great ideas based on a somehow "contend based location system" for files, like IPFS, are a refreshing alternative to this. Since the browser support is very good for IPFS and beyond this "technical issue", thing will become much simpler to organize and allocate.
I think this could be a great investment in the portability of notebooks in general, if for instance IPFS will get included. I'm not having the full picture in mind yet, but a good gut feeling about this. IPFS based file scheme is a pretty experimental concept, probably would be a challenge to adopt across jupyter projects as a whole. The underlying issue is with associated assets in different contexts. They make a lot of assumptions that don't hold up well for nbconvert's execution model.
It seems they have an open issue for this: open since August For anyone experiencing this issue I found what seems to be a workaround after none of the above did. Please try enabling it if you encounter problems. Search PyPI Search. Latest version Released: Apr 23, Jupyter extension to export notebooks as PDFs. Navigation Project description Release history Download files.
Project links Homepage. Maintainers betatim. Three new features compared to the official "save as PDF" extension: produce a PDF with the smallest number of page breaks, the original notebook is attached to the PDF; and this extension does not require LaTex.
Install To use this bundler you need to install it: python -m pip install -U notebook-as-pdf pyppeteer-install The second command will download and setup Chromium.