I want to convert my ipython-notebooks to print them, or simply send them in html format. I have noticed that there exists a tool to do that already, nbconvert. Although I h
You can use this simple online service. It supports both HTML and PDF.
nbconvert is not yet fully replaced by nbconvert2, you can still use it if you wish, otherwise we would have removed the executable. It's just a warning that we do not bugfix nbconvert1 anymore.
The following should work :
./nbconvert.py --format=pdf yourfile.ipynb
If you are on a IPython recent enough version, do not use print view, just use the the normal print dialog. Graph beeing cut in chrome is a known issue (Chrome does not respect some print css), and works much better with firefox, not all versions still.
As for nbconvert2, it still highly dev and docs need to be written.
Nbviewer use nbconvert2 so it's pretty decent with HTML.
List of current available profiles:
$ ls -l1 profile|cut -d. -f1
base_html
blogger_html
full_html
latex_base
latex_sphinx_base
latex_sphinx_howto
latex_sphinx_manual
markdown
python
reveal
rst
Give you the existing profiles.
(You can create your own, cf future doc, ./nbconvert2.py --help-all
should give you some option you can use in your profile.)
then
$ ./nbconvert2.py [profilename] --no-stdout --write=True <yourfile.ipynb>
And it should write your (tex) files as long as extracted figures in cwd. Yes I know this is not obvious, and it will probably change hence no doc...
The reason for that is that nbconvert2 will mainly be a python library where in pseudo code you can do :
MyConverter = NBConverter(config=config)
ipynb = read(ipynb_file)
converted_files = MyConverter.convert(ipynb)
for file in converted_files :
write(file)
Entry point will come later, once the API is stabilized.
I'll just point out that @jdfreder (github profile) is working on tex/pdf/sphinx export and is the expert to generate PDF from ipynb file at the time of this writing.
From the docs:
If you want to provide others with a static HTML or PDF view of your notebook, use the Print button. This opens a static view of the document, which you can print to PDF using your operating system’s facilities, or save to a file with your web browser’s ‘Save’ option (note that typically, this will create both an html file and a directory called notebook_name_files next to it that contains all the necessary style information, so if you intend to share this, you must send the directory along with the main html file).
Only this answer would be useful to you if you have math, scientific formulae in your document. Even if you don't have them it works fine.
GUI way
Go to Files > Download as > HTML or PDF via LaTeX
Then check your Downloads folder for the file. PS: If LaTeX had any errors while compiling the PDF, it will fail. If this happens, download the HTML file and then use http://webpagetopdf.com/ or any other similar service to convert the HTML to PDF.
Command-Line way
If you are using sagemath cloud version, you can simply go to the left corner,
select File → Download as → Pdf via LaTeX (.pdf)
Check the screenshot if you want.
Screenshot Convert ipynb to pdf
If it dosn't work for any reason, you can try another way.
select File → Print Preview and then on the preview
right click → Print and then select save as pdf.
Other suggested approaches:
Using the 'Print and then select save as pdf.' from your HTML file will result in loss of border edges, highlighting of syntax, trimming of plots etc.
Some other libraries have shown to be broken when it comes to using obsolete versions.
Solution: A better, hassle-free option is to use an online converter which will convert the *.html version of your *.ipynb to *.pdf.
Steps:
File > Download as > HTML(.html)
Upload the newly created *.html file here and then select the option HTML to PDF.
Your pdf file is now ready for download.
You now have .ipynb, .html and .pdf files