0

My goal is to present .ipynb file to the management. However, some management is non-IT. So, I would like to present them like GitHub

or is there a .js library to do this?

Jason Rich Darmawan
  • 1,607
  • 3
  • 14
  • 31
  • If you want to explore options other than PDF, you can use nbviewer perhaps? Your example using that is [here](https://github.com/kidfrom/hacktiv8-ftds-fase0/blob/master/day02/pandas/main.ipynb). [It seems](https://stackoverflow.com/questions/22020129/how-to-make-nbviewer-display-local-files) you can install nbviewer locally via the github repo. Also, see the first three paragraphs [here](https://stackoverflow.com/a/71094775/8508004) and [discussion here](https://discourse.jupyter.org/t/how-do-you-share-notebooks-best-practices-around-sharing-to-external-stakeholders/3617/8). – Wayne Oct 06 '22 at 20:36
  • And since you specifically mention a `.js` library, I'll highlight that [nbpreview](https://github.com/jsvine/nbpreview) that is featured in one of the links above, is built on [notebookjs](https://github.com/jsvine/notebookjs). – Wayne Oct 06 '22 at 20:39

1 Answers1

0

You can convert your .ipynb file to a PDF file

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

Then use django to render as a pdf file

from django.http import FileResponse, Http404

def pdf_view(request):
    try:
        return FileResponse(open('notebook.pdf', 'rb'), content_type='application/pdf')
    except FileNotFoundError:
        raise Http404()
Kiran S
  • 181
  • 10