nbconvert
nbconvert
is an official package, and other answers have mentioned it. However, they did not mention there are two ways to convert to PDF.
The default option uses LaTeX, and it's often a pain to install:
jupyter nbconvert notebook.ipynb --to=pdf

A newer option is to use the webpdf
converter, this does not require LaTeX
jupyter nbconvert notebook.ipynb --to=webpdf

Quarto
Quarto is the newest option. The defaults are prettier than nbconvert
, and it has advanced features to customize the output PDF. However, it uses pandoc
(and pandoc
uses LaTeX), so you must install both first.
quarto render notebook.ipynb --to pdf
Quarto is a new project, and I often run into problems (I couldn't convert the sample notebook); however, the project is in active development and I'm sure it will get better.
Online converters
The last option is to use one of the many online services. The two main caveats are 1) You might not want to upload your notebooks to some random website, and 2) It's often unclear what engine they use to convert the notebooks. I've tried many of them with mostly negative results.
I created one online converter that uses nbconvert
and deletes your notebook as soon as it's converted.