Skip to content

How to Convert .ipynb to PDF

Published on

Updated on

Convert a Jupyter Notebook to PDF fast: run jupyter nbconvert --to pdf notebook.ipynb. No LaTeX? Use --to webpdf. Includes VSCode, Colab, browser print, and fixes for the xelatex not found error.

A .ipynb file is a Jupyter Notebook: JSON that bundles your code, outputs, charts, and markdown. A PDF flattens all of that into one portable document anyone can open, print, or attach — which is why notebooks usually get exported to PDF for reports, assignments, and reviews.

Quick answer

Pick the route that matches your setup:

On the command line, nbconvert ships with Jupyter:

jupyter nbconvert --to pdf notebook.ipynb

That route renders through LaTeX. If you do not have a TeX distribution installed (the common xelatex not found error), use the Chromium-based exporter instead — no LaTeX required:

pip install "nbconvert[webpdf]"
jupyter nbconvert --to webpdf --allow-chromium-download notebook.ipynb

VSCode, Jupyter, and Google Colab can also print to PDF. Pick the method that matches what you already have:

MethodInstall neededBest for
Online converter (RunCell)NothingOne-off files, no local Python
RunCell JupyterLab extensionpip install runcell (once)Local JupyterLab users; PDF, HTML, and .py from one menu
nbconvert --to pdfJupyter + LaTeXClean, publication-style PDFs
nbconvert --to webpdfJupyter + ChromiumSame, but no LaTeX setup
VSCode exportVSCode + Jupyter ext.People already coding in VSCode
Browser / Jupyter printNothing extraOne-off, no-setup route
Google Colab printNothing (cloud)Notebooks already in Colab

Method 1: Online converter (no install)

When you need one PDF and do not want to set anything up, an online converter handles the conversion in the browser.

RunCell's ipynb-to-PDF converter (opens in a new tab) is free and needs no sign-up:

  1. Drop your .ipynb onto the page, or click Try Sample Notebook to test it first.
  2. Check the preview.
  3. Click Generate PDF, then choose Save as PDF in the print dialog.

The standard Generate PDF path runs entirely in your browser, so the notebook is not uploaded.

Runcell online ipynb to pdf converter

Other general-purpose options include Vertopal and OnlineConvertFree. Avoid uploading notebooks that contain credentials, private data, or proprietary code to third-party sites.

Method 2: Export from JupyterLab with the RunCell extension

If you run Jupyter on your own machine and export notebooks more than once, this is the least-friction route. RunCell is a JupyterLab extension that adds an export menu to every notebook's toolbar. PDF, HTML, and .py are one click away, and none of them need LaTeX.

Install it once, then restart JupyterLab:

pip install runcell
jupyter lab

It needs JupyterLab 4.4 or newer and Python 3.10+. To install with conda, uv, or the JupyterLab Extension Manager instead, see the RunCell install page (opens in a new tab).

To export a notebook to PDF:

  1. Open the .ipynb in JupyterLab and run the cells whose outputs you want in the PDF.
  2. Click the RunCell icon in the notebook toolbar, next to the cell-type dropdown.
  3. Choose Export as PDF(.pdf). When the browser's print dialog opens, set the destination to Save as PDF and save.

RunCell icon → Export as PDF(.pdf) → Save as PDF. Code, outputs, and charts carry over.

Export as HTML(.html) and Export as Python(.py) in the same menu download the file directly. Each export saves the notebook first, so the file matches what you see on screen.

Why it is the easiest local route:

  • No LaTeX. The PDF comes from the browser's print engine, so the xelatex not found error cannot happen.
  • Your notebook stays with you. The conversion runs on your own Jupyter server and browser; nothing is uploaded to a third-party service.
  • Three formats, one menu. PDF for reports, HTML for sharing, .py for scripts.

You do not need a RunCell account to export. Signing in unlocks the extension's AI features, such as the Code Review item in the same menu, which asks RunCell's AI to review your notebook.

Method 3: nbconvert (the canonical way)

nbconvert is the official Jupyter export tool. The PDF exporter converts your notebook to LaTeX, then compiles it, so you need both Jupyter and a TeX distribution (TeX Live, MiKTeX, or MacTeX) plus Pandoc.

# one-time setup if you do not have them
pip install nbconvert
# install a LaTeX distribution + pandoc via your OS package manager
 
# convert
jupyter nbconvert --to pdf notebook.ipynb

This produces notebook.pdf in the same folder. It gives the most polished, print-ready result, but the LaTeX dependency is the part that trips most people up (see Troubleshooting).

No LaTeX? Use webpdf

The webpdf exporter renders the notebook with a headless Chromium browser instead of LaTeX, so you skip the entire TeX install:

pip install "nbconvert[webpdf]"
jupyter nbconvert --to webpdf --allow-chromium-download notebook.ipynb

The first run downloads a small Chromium build. After that, conversions are fast and the layout matches what you see in the browser.

HTML as a fallback

When both routes fail, export to HTML and print that page to PDF from your browser. It always works:

jupyter nbconvert --to html notebook.ipynb

Method 4: Export to PDF in VSCode

If you already edit notebooks in Visual Studio Code with the Jupyter extension:

  1. Open the .ipynb file in VSCode.
  2. Click the ... (More Actions) menu at the top of the notebook.
  3. Choose Export and select PDF.

VSCode uses nbconvert under the hood, so the same LaTeX dependency applies. If the PDF export errors out, export to HTML from the same menu and print that to PDF.

Method 5: Print to PDF (no install)

Every notebook environment can reach "Print", and every OS can print to PDF. This is the quickest path when you just need one file.

  • Jupyter Notebook / JupyterLab: File > Save and Export Notebook As… > HTML, open the HTML, then Ctrl/Cmd + P > Save as PDF. Classic Notebook also has File > Download as > PDF via LaTeX.
  • Any browser: with the notebook or its HTML open, press Ctrl/Cmd + P and choose Save as PDF as the destination.

The tradeoff: long cells can break awkwardly across pages, so review the output.

Method 6: Google Colab

If your notebook lives in Google Colab, you do not need anything installed locally:

  1. Open the notebook in Colab.
  2. Go to File > Print.
  3. In the print dialog, set the destination to Save as PDF.

Colab renders the page through the browser, so the result mirrors the on-screen layout.

Troubleshooting

nbconvert failed: xelatex not found / PDF creating failed

The PDF exporter needs LaTeX. Either install a TeX distribution (TeX Live, MiKTeX, MacTeX) and Pandoc, or switch to the no-LaTeX route:

jupyter nbconvert --to webpdf --allow-chromium-download notebook.ipynb

If you work in JupyterLab, the RunCell extension's Export as PDF(.pdf) skips LaTeX entirely — see Method 2.

nbconvert: command not found

nbconvert is not installed or not on your PATH. Install it and call it through Python to be safe:

pip install nbconvert
python -m jupyter nbconvert --to pdf notebook.ipynb

Plots or wide tables get cut off

LaTeX page width is fixed. Reduce figure size in the notebook before export, or use --to webpdf / HTML print, which wrap content to the page more forgivingly.

Output is missing cells

Make sure the notebook is saved and all cells have run. nbconvert exports the saved state, not the live kernel, so re-run and save before converting.

FAQ

What is the command to convert ipynb to PDF?

Run jupyter nbconvert --to pdf notebook.ipynb. If you do not have LaTeX installed, use jupyter nbconvert --to webpdf --allow-chromium-download notebook.ipynb instead.

How do I convert ipynb to PDF without LaTeX?

Use the webpdf exporter (pip install "nbconvert[webpdf]" then --to webpdf), or export to HTML and print to PDF from your browser. RunCell's online converter and its JupyterLab extension also produce PDFs without a TeX installation.

Can I export a notebook to PDF directly inside JupyterLab?

Yes. Install the RunCell extension with pip install runcell and restart JupyterLab. Then click the RunCell icon in the notebook toolbar, choose Export as PDF(.pdf), and pick Save as PDF in the print dialog. No LaTeX is needed, and the same menu exports HTML and .py.

How do I convert ipynb to PDF in VSCode?

Open the notebook, click the ... menu at the top, choose Export, and select PDF. VSCode uses nbconvert, so install LaTeX or export to HTML if the PDF step fails.

How do I convert a Colab notebook to PDF?

In Google Colab, open the notebook and use File > Print, then set the destination to Save as PDF.

How do I convert ipynb to HTML instead?

See our guide on converting .ipynb to HTML.

Related Guides