DEV Community

CodeFox
CodeFox

Posted on

How to Export a Jupyter Notebook to a Clean PDF Without Fighting nbconvert

Jupyter notebooks are great while you are exploring data, but they can become awkward when the next person only needs to read the result. A notebook may include setup cells, scratch code, environment-specific paths, widgets, and long outputs that make a PDF export noisy.

I usually separate notebook exports into two cases:

  • a full notebook export for technical review
  • a clean report export for readers who only need the explanation, charts, tables, and conclusions

The second case is where many built-in export flows feel brittle. Local nbconvert can fail because of missing LaTeX packages, VS Code can produce inconsistent formatting, and browser print-to-PDF often needs manual cleanup.

A practical workflow

  1. Run the notebook so the outputs you care about are saved in the .ipynb file.
  2. Decide whether the reader needs code.
  3. Export a report-style PDF if the audience is a manager, client, teacher, or non-technical reviewer.
  4. Export a full notebook PDF if the reviewer needs to inspect the code cells.
  5. Preview the generated PDF before sending it.

I put together a small browser tool for this workflow: IPYNB Tools. The main converter turns a saved Jupyter Notebook into a PDF and lets you choose a report-style export or a full notebook export.

For the Jupyter-specific page, I also wrote a short guide here: ipynb to pdf converter.

When report mode helps

Report-style export works well when the notebook is already complete and the recipient does not need to run it. Common examples:

  • student assignments with charts and conclusions
  • internal data analysis summaries
  • teaching notes
  • client-facing experiment reports
  • quick research artifacts that should be easy to read offline

Full notebook export is still better when the code itself is the deliverable. The important thing is to choose the artifact based on the reader, not just on the tool that happens to be available.

A small checklist before exporting

  • Save the notebook after running the important cells.
  • Check that charts and tables are visible in the notebook output.
  • Remove private file paths, credentials, and scratch cells.
  • Use report mode for readers and full mode for technical review.
  • Preview the PDF before sharing it.

This has made notebook handoff less frustrating for me, especially when local PDF dependencies are not installed or when a clean reader-facing report is more useful than a raw notebook dump.

Top comments (0)