← Back to list

How to convert Jupyter Notebook to PDF : The roundabout but easier(?) way.

Python Quickies # 20

Prathik C · 2025-01-30 13:46 · 1 claps · 1.7 min read
#jupyter-notebook #jupyter #ipynb #pdfconversion #learn-python
Open on Medium ↗

How to convert Jupyter Notebook to PDF : The roundabout but easier(?) way.

Python Quickies # 20

This image is AI generated (in case you couldnt tell!)

This image is AI generated (in case you couldnt tell!)

Skip right to the end if you dont want the story of how I got to my solution. Yes, this is one of those posts :D

Jupyter to PDF

.ipynb → .pdf

One would assume that this would be a straightforward endeavour. Alas, it turned out not to be.

Based on my research into this, what I learnt was that one could do this directly from the Jupyter Notebook interface (File>>Download As>>PDF). Or there is the alternative of CLI :

jupyter nbconvert --to pdf your_notebook.ipynb

Note that in either case, there’s a pre-requisite of LaTex distribution needing to be installed. So I tried going with the lightweight, bare minimum [BasicTex](https://www.tug.org/mactex/morepackages.html) distribution for my mac (because the full [MacTex](https://www.tug.org/mactex/mactex-download.html) distribution is gigantic (~5 GB). I tried with BasicTex and found that the process (interface and CLI) kept throwing errors.

So I finally installed the entire MacTex. Sadly though, it still gave me the similar errors as before. After spending an hour or so more on trying to fix it, I gave up.

Along came Colab

I opened the notebook in google colab and attempted to Print →Save as PDF. While it did work, it was quite sad. The formatting was not great. But yes, at a pinch, one can do this. Unsurprisingly, the best results were on Chrome.

To HTML first?

I had also come across the point that one can convert the notebook to an HTML file. So I gave that a shot. I used the CLI.

jupyter nbconvert --to html your_notebook.ipynb

The HTML conversion works beautifully. The formatting is maintained and everything looked so nice. Alas, it is still not PDF which as we know is THE standard for sharing documents.

So I tried the most obvious thing, which is to open the html file on chrome and do the whole Print → Save as PDF trick. And voila, pretty good results!

Until next time:)

PS — Someone showed me this online converter. I am judging myself for not having found this earlier. Even as one might worry about privacy concerns, this Vertopal converter does an excellent job:

[embed]Online IPYNB (Jupyter Notebook) to PDF Converter Convert IPYNB (Jupyter Notebook) documents to PDF file format using Vertopal free online converter tools. You can edit…www.vertopal.com


메타데이터
post_id
080900904752
slug
how-to-convert-jupyter-notebook-to-pdf-the-roundabout-but-easier-way-080900904752
url
https://medium.com/@prathik.codes/how-to-convert-jupyter-notebook-to-pdf-the-roundabout-but-easier-way-080900904752
canonical_url
https://medium.com/@prathik.codes/how-to-convert-jupyter-notebook-to-pdf-the-roundabout-but-easier-way-080900904752
author_url
https://medium.com/@prathik.codes
status
ok
fetched_at
2026-06-26 12:24:55