Jupyter Notebook to PDF!

This blog aims to explain the process of converting a Jupyter Notebook into a PDF Format.

Harshit Dawar
2 min readMar 24, 2022
Source

Jupyter Notebook being the most used IDE nowadays in the data science & machine learning community, not only provides a flexible way to code & present, but in addition to that, it provides many more features, conversion of Jupyter Notebook to PDF file is one among them.

Many times we require to present our work to non-technical persons also, they might not understand the “.ipynb” format or “.py” format. Therefore, they should be provided with something that they are most comfortable with, & there is no other format of data other than PDF with which most of the people are comfortable. Having that thought in the mind, I am writing this blog to help everyone who is struggling to showcase their work in a common format or who is struggling to convert their Jupyter Notebooks into PDF Files.

Now, that being said, let’s proceed!

Converting Jupyter Notebook to PDF Files!

It’s a very simple 2 step process & is as follows:

  1. You have to install an important package (Just make sure you have “pip3” => python package manager installed separately or natively with anaconda distribution). The package that has to be installed is “notebook-as-pdf”. Run the command shown below to install this package from your terminal or anaconda prompt based on your Operating System.
pip3 install notebook-as-pdf

2. Now, you just have to convert the Jupyter Notebook to PDF using the command mentioned below. After running the below-given command the first time, it will automatically download one package of chromium. Therefore, don't worry, it is just a one-time thing.

jupyter-nbconvert <Path to Jupyter Notebook>  --to PDFviaHTML

For example:

jupyter-nbconvert MyNotebook.ipynb  --to PDFviaHTML

Now, you are ready with your PDF file of the Jupyter Notebook. Congratulations!

I hope my article explains each and everything related to the topic with all the detailed concepts and explanations. Thank you so much for investing your time in reading my blog & boosting your knowledge. If you like my work, then I request you to applaud this blog & follow me on Medium, GitHub, & LinkedIn for the more amazing content on multiple technologies and their integration!

Also, subscribe to me on Medium to get the update of all my blogs!

--

--

Harshit Dawar

AIOPS Engineer, have a demonstrated history of delivering large and complex projects. 14x Globally Certified. Rare & authentic content publisher.