Print Jupyter Notebook as PDF: A Step-by-Step Guide

Gloria Jul 16, 2026

Are you looking to convert your Jupyter Notebook into a PDF for easy sharing or printing? Jupyter Notebook's interactivity and rich output formats make it an excellent tool for data analysis and visualization, but sometimes you might want to share or present your work in a PDF format. Here's a step-by-step guide on how to print a Jupyter Notebook as a PDF usingNBConvert, along with some tips and tricks.

Notebook to pdf online
Notebook to pdf online

First, let's understand the basic process. NBConvert is a tool that converts Jupyter Notebook documents (.ipynb) to various formats, including PDF. It's a part of thenbconvert command-line tool, which comes bundled with Jupyter Notebook. The conversion process involves two steps: executing the notebook to generate outputs and then converting it to a PDF.

How to Print a PDF Booklet with Correct Page Order in Foxit PDF Editor Editing Tutorials
How to Print a PDF Booklet with Correct Page Order in Foxit PDF Editor Editing Tutorials

Setting Up NBConvert

Before you begin, ensure that you have Jupyter Notebook installed in your environment. If you don't, you can install it using pip:

Threadless Spiral Notebook Template
Threadless Spiral Notebook Template

pip install jupyter

Installing NBThemes (Optional but Recommended)

free printable lined paper you pick the colors
free printable lined paper you pick the colors

While not necessary, installing nbthemes can significantly improve the appearance of your PDF. It provides a collection of themes that you can apply to your notebook before conversion. You can install it using pip:

pip install nbthemes

Setting a Default Theme

How To Print Out Bullet Journal Pages To Fit The Size Of Your Journal
How To Print Out Bullet Journal Pages To Fit The Size Of Your Journal

After installing nbthemes, you can set a default theme for all your notebooks using the following command in your Jupyter Notebook:

%load_ext nbthemes
%themes -t

Converting Jupyter Notebook to PDF

How to Make a Traveler's Notebook Junk Journal
How to Make a Traveler's Notebook Junk Journal

Now that your environment is set up, let's convert your Jupyter Notebook to a PDF. Suppose you have a Jupyter Notebook named my_notebook.ipynb in your current directory.

Executing the Notebook

College Ruled Printable Notebook Paper | Templates at allbusinesstemplates.com
College Ruled Printable Notebook Paper | Templates at allbusinesstemplates.com
Lined Paper Printable Templates - 38 Free Printables | SaturdayGift
Lined Paper Printable Templates - 38 Free Printables | SaturdayGift
a person holding three notebooks in front of a pink background with flowers on it
a person holding three notebooks in front of a pink background with flowers on it
Free Printable Lined Notebook Paper - PDF for Printing
Free Printable Lined Notebook Paper - PDF for Printing
Easy Printable Junk Journal Tutorial + Free Printable Junk Journal Kit
Easy Printable Junk Journal Tutorial + Free Printable Junk Journal Kit
Free Writing Journal Templates | Make Your Own Journal
Free Writing Journal Templates | Make Your Own Journal
28 Printable Journal Pages (Free PDF Printables)
28 Printable Journal Pages (Free PDF Printables)
Free Printable Notebook Paper: Perfect for School Use!
Free Printable Notebook Paper: Perfect for School Use!
Create a notebook with me
Create a notebook with me
Customize Your School Notebooks
Customize Your School Notebooks

The first step is to execute your notebook to generate outputs. You can do this using the following command:

jupyter nbconvert --to notebook --execute my_notebook.ipynb

Converting the Notebook to PDF

After executing the notebook, you can convert it to a PDF using the following command:

jupyter nbconvert --to pdf my_notebook.ipynb

By default, this command will generate a PDF named my_notebook.pdf in the same directory as your notebook.

Customizing the PDF Output

NBConvert provides various options to customize your PDF output. You can specify a theme for your PDF using the --theme flag:

jupyter nbconvert --to pdf --theme my_notebook.ipynb

You can also add a table of contents to your PDF using the --include-output flag:

jupyter nbconvert --to pdf --include-output my_notebook.ipynb

For a full list of available options, you can use the --help flag:

jupyter nbconvert --help

Troubleshooting

If you encounter any errors during the conversion process, it's likely that there are issues with your Jupyter Notebook. Common problems include:

Cell Execution Errors

If a cell in your notebook returns an error during execution, NBConvert will stop the conversion process. To continue the conversion, you need to correct the errors in your notebook and re-run the conversion command.

Missing Dependencies

If your notebook relies on libraries or packages that are not installed in your environment, you may encounter errors during the conversion process. Make sure that all of the dependencies required by your notebook are installed before attempting to convert it to a PDF.

In conclusion, converting a Jupyter Notebook to a PDF is a straightforward process using NBConvert. With a bit of setup and some command-line tweaks, you can generate high-quality PDFs from your notebooks, complete with your choice of theme and a table of contents. Happy converting!