Skip to main content

Jupyter Notebooks as PDF

Binder

This Jupyter notebook extension allows you to save your notebook as a PDF.

Three new features compared to the official "save as PDF" extension:

  1. produce a PDF with the smallest number of page breaks,
  2. the original notebook is attached to the PDF; and
  3. this extension does not require LaTex.

The created PDF will have as few pages as possible, in many cases only one. This is useful if you are exporting your notebook to a PDF for sharing with others who will view it on a screen.

Every <h1> tag in the notebook will be converted into a entry in the table of contents of the PDF.

To make it easier to reproduce the contents of the PDF at a later date the original notebook is attached to the PDF. Unfortunately not all PDF viewers know how to deal with attachments. PDF viewers known to support downloading of file attachments are: Acrobat Reader, pdf.js and evince. The pdftk CLI program can also extract attached files from a PDF. Preview for OSX does not know how to display/give you access to attachments of PDF files.

Install

To use this bundler you need to install it:

python -m pip install -U notebook-as-pdf
pyppeteer-install

The second command will download and setup Chromium. It is used to perform the HTML to PDF conversion.

On linux you probably also need to install some or all of the APT packages listed in binder/apt.txt.

Use it

Create a notebook and the click "File -> Download As". Click the new menu entry called "PDF via HTML". Your notebook will be converted to a PDF on the fly and then downloaded.

You can also use it with nbconvert:

jupyter-nbconvert --to pdfviahtml example.ipynb

which will create a file called example.pdf.

You will have to use Acrobat Reader to see the attachment to your PDF. Preview on OSX can not display PDF attachments.

Release files for notebook-as-pdf 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for notebook-as-pdf 0.5.0
File Size Uploaded
notebook-as-pdf-0.5.0.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for notebook-as-pdf 0.5.0
File Interpreter ABI Platform
notebook_as_pdf-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.7 kB

Release files / notebook-as-pdf-0.5.0.tar.gz

Download URL notebook-as-pdf-0.5.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c0d90c48d9f42f6dd4c16db5b7c54a6553ec8948a98539d7d06d54501b0fae85
BLAKE2b-256 checksum
How to use checksums
482124717d37b0b6f71d4c9a69e4bf5b461b5241aba41cddefc7bcf3cb763820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release files / notebook_as_pdf-0.5.0-py3-none-any.whl

Download URL notebook_as_pdf-0.5.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae0f6b7fb5c80970cf6a25cdba2d1630e7ced8546563bbaf2b46f7c24530b456
BLAKE2b-256 checksum
How to use checksums
beaa33c6dc40a09b01d77a657e95461932463e4c061ba623e6bbc4f6ab15634d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page