Exporting notebook from VS Code returns corrupted pdf or blank HTML

Viewed 2373

I'm using VS Code and want to export the output of a basic Jupyter Notebook (.ipynb file) into an HTML page or PDF file but both method fails: HTML page is empty (0K file) and the PDF file cannot be opened (0K file).

Thanks for your help.

1 Answers

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text.

Jupyter Notebooks are an open document format based on JSON. They contain a complete record of the user's sessions and include code, narrative text, equations and rich output.

Therefore you cannot export a notebook's "environment" to html or pdf. You can only export your Jupyter notebook as a printout of your code and cells. I am using Jupyter Lab which shows more than a dozen formats available for export. I can't speak about all of the export types, but exporting as html or pdf will result in displaying your code and cells (basically the same as a screen print of your open Jupyter file) in html (your browser) or pdf (pdf reader).

Using Jupyter in Windows and using MS edge, when "Export Notebook As" is used, then for Jupyter file is downloaded - Watch the lower left corner of your browser for the file to download. This computer downloads to the default Windows download folder. From that folder, I can click on the downloaded Jupyter file and the Jupyter code will be displayed in the browser or the pdf reader. The link below shows a Jupyter file opened in the browser.

link

[1]: https://i.stack.imgur.com/jbU8c.png

Related