This has been an ongoing issue for me, as I would love to use Jupyter Notebook to write my research reports, but have found it very difficult to export my Jupyter Notebooks to PDF without code and without large formatting errors.
I am able to download the notebooks as PDF, but have not found a way to hide the code, or have the PDF resemble the formatting of the notebook.
No solution I've found on SO has been sufficient for my issue, so it may be possible that this is not the intended functionality of Jupyter Notebook.
Download Jupyter Notebook as PDF The Jupyter Notebook has an option to export the notebook to many formats. It can be accessed by clicking File -> Download as -> PDF via LaTeX (or PDF via HTML - not visible in the screenshot).
Saving a Jupter notebook Saving your edits is simple. There is a disk icon in the upper left of the Jupyter tool bar. Click the save icon and your notebook edits are saved.
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.
I followed the suggestion by 0xffff above but the PDF output did not behave as intended (code blocks were still included).
However, their suggestion inspired me to try converting to html first using the following call:
jupyter nbconvert path/to/your/ipynb --to=html --TemplateExporter.exclude_input=True
This behaved as intended, and from there, it was straightforward to print the output to PDF in a browser.
Regarding the issue with the --to=pdf
flag, I've opened up an issue on the Jupyter Notebook git repo: https://github.com/jupyter/notebook/issues/3804. Will report back once I get a response.
Have you tried this:
jupyter nbconvert path/to/your/ipynb --to=pdf --TemplateExporter.exclude_input=True
For more on the flags, you can refer to nbconvert config options
I have successfully converted .ipynb to .html exclude the code blocks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With