Jupyter notebooks are great for working, but awkward to share. Send an .ipynb file to a manager, a client or a professor and they need Jupyter, VS Code or Colab just to read it. A PDF opens anywhere, keeps your charts and outputs exactly as they were, and can be attached to a report or a ticket.
The catch is that “export to PDF” in Jupyter has a reputation for failing with LaTeX errors. Here are six ways to do it, starting with the most common and ending with options that need no setup at all.
1. nbconvert with LaTeX (--to pdf)
nbconvert is the official converter that ships with Jupyter. The classic command is:
jupyter nbconvert --to pdf analysis.ipynb
This route goes through LaTeX, so you need pandoc and a TeX distribution (TeX Live, MacTeX or MiKTeX) installed. When it works, the output looks like a typeset document, with good maths rendering. When it fails, it is almost always a missing TeX package or an unusual character in a Markdown cell.
Best for: academic work and notebooks heavy on equations.
2. nbconvert with a headless browser (--to webpdf)
If you don’t want to install LaTeX, the WebPDF exporter renders the notebook in headless Chromium and prints it, so the PDF looks much like the notebook does in your browser:
pip install "nbconvert[webpdf]"
playwright install chromium
jupyter nbconvert --to webpdf analysis.ipynb
The extra installs pull in Playwright and a Chromium build. After that it is usually the most dependable command-line option, and it handles HTML outputs such as styled pandas tables better than LaTeX does.
Best for: data notebooks with tables, plots and widgets.
3. Export from the JupyterLab menu
In JupyterLab, open File > Save and Export Notebook As and choose PDF or WebPDF. These menu items call the same nbconvert exporters as above, so the same requirements apply: LaTeX for PDF, Playwright and Chromium for WebPDF. The menu is convenient, but the error messages are clearer if you run the command in a terminal.
4. VS Code’s Jupyter extension
If you work in VS Code, open the notebook, click the … menu at the top of the notebook and choose Export, then pick PDF. Behind the scenes it also uses nbconvert, so you still need a TeX installation for PDF output. If that isn’t available, exporting to HTML and printing that HTML to PDF from your browser is a quick workaround.
5. Quarto
Quarto can render Jupyter notebooks directly and gives you much more control over the final document: title page, table of contents, code folding, and the option to hide code and show only results. Install a lightweight TeX distribution once, then render:
quarto install tinytex
quarto render analysis.ipynb --to pdf
You can add a YAML block in the first cell of the notebook to set the title, author and formatting options.
Best for: reports you want to look professional, especially when readers only care about results, not code.
6. Browser printing or an online converter
Sometimes you just need a PDF in the next two minutes. Two quick options:
- Google Colab: open the notebook, run it so all outputs are present, then use File > Print and save as PDF. Long code lines may get cut off, so check the result.
- An online converter: PDFVerge is a free PDF toolkit with an IPYNB to PDF converter. Upload the notebook and download a PDF with the code, Markdown and saved outputs, with no Python environment and no signup. It is handy when you are on a machine without Jupyter, or when a teammate sends you a notebook you only need to read. As with any online tool, don’t upload notebooks that contain credentials, API keys or confidential data.
Tips for a cleaner PDF, whichever method you use
- Restart and run all before exporting, so outputs are complete and in order.
- Clear noisy output such as long training logs or warnings before converting.
- Hide code you don’t need to show. nbconvert has a --no-input flag that exports only outputs and Markdown, which is ideal for non-technical readers.
- Check wide tables and long lines. PDF pages have fixed widths; wrap long lines and avoid printing huge DataFrames.
- Use a Markdown title cell at the top so the PDF starts with a clear heading.
Quick decision guide
|
Situation |
Best option |
|
Lots of equations |
nbconvert --to pdf |
|
Tables, plots, no LaTeX installed |
nbconvert --to webpdf |
|
Polished report for readers |
Quarto |
|
No Python on this machine |
Online converter or Colab print |
The right method is the one that works on the machine you are using today. For repeatable reports, script it with nbconvert or Quarto. For the occasional one-off, a browser-based converter saves the setup.
