ipynbtopdfscanner

How to Hide Code in a Jupyter Notebook PDF (Show Only Outputs)

Export a Jupyter notebook to PDF without code cells: use nbconvert --no-input, cell tags like remove_input, or one switch in ipynbtopdfscanner.

Updated · by the ipynbtopdfscanner team

Quick answer: With nbconvert, add --no-input: jupyter nbconvert --to pdf --no-input notebook.ipynb. To hide only some cells, tag them remove_input or remove_cell. In ipynbtopdfscanner, switch off Show code, or tap a single cell and choose Hide this cell.

Hide all code with nbconvert

jupyter nbconvert --to pdf --no-input notebook.ipynb

--no-input removes every code cell and its In [ ] prompt, leaving text and outputs. Use --no-prompt to keep the code but drop the In [ ] / Out [ ] labels.

Hide only some cells with tags

  1. In JupyterLab, open the property inspector (gear icon) and add a tag to the cell, e.g. remove_input (hide code, keep output) or remove_cell (hide everything).
  2. Export with the tag remover turned on:
jupyter nbconvert --to pdf notebook.ipynb \
  --TagRemovePreprocessor.enabled=True \
  --TagRemovePreprocessor.remove_input_tags='{"remove_input"}' \
  --TagRemovePreprocessor.remove_cell_tags='{"remove_cell"}'

The easy way: ipynbtopdfscanner

Skip the setup: convert your notebook to PDF in your browser, free and private.

Open the converter

Frequently asked questions

Will hiding code remove the outputs too?

No. Hiding code (--no-input, remove_input or “Show code” off) keeps the outputs such as tables and charts.

Can I hide a cell without editing the notebook?

Yes. In ipynbtopdfscanner you hide cells in the preview; the .ipynb file itself is not changed.