Skip to main content

Jupyter extension to export notebooks as PDFs

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notebook-as-pdf-updated-0.5.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

notebook_as_pdf_updated-0.5.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file notebook-as-pdf-updated-0.5.1.tar.gz.

File metadata

  • Download URL: notebook-as-pdf-updated-0.5.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for notebook-as-pdf-updated-0.5.1.tar.gz
Algorithm Hash digest
SHA256 3caa45c05352cd6f9190852b4ccf1c77e8c29561b80db2f097024da7b51541a1
MD5 af52ad386dc83b0a75a87c4b9481398c
BLAKE2b-256 7be3a4de5d88aae2825a3542f318e9272979a8be9b61d179acd203518d4e5ebc

See more details on using hashes here.

File details

Details for the file notebook_as_pdf_updated-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: notebook_as_pdf_updated-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for notebook_as_pdf_updated-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a233d279c4cf421c7bd0927b9e2af75c9030962e7c1018f5bbe8d7cd06ef569d
MD5 27f3ed2fc50446cbd8a3f830c8fa97ef
BLAKE2b-256 848526adb3955671626f75fa5ae47ca1207e1662fbf0f3f25a823fedf23b81ea

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page