Print to PDF in the browser
In JupyterLab, you can hide the cell's input and output by clicking the side bar as demonstrated in the doc. After hiding, you can use the browser's printing menu to generate a PDF. I've tested it on FireFox and expect similar result on Chrome or Edge.

Export to PDF with nbconvert
If you aim at a native conversion from ipynb
format to pdf
, the nice old nbconvert
tool is your friend. It usually comes together with Jupyter and can be invoked conveniently in the menu of JupyterLab File->Export Notebook As...->PDF
or, in the classic Jupyter Notebook interface, File->Download as->PDF (via LaTeX)
.
Hiding input/output in cells can be realized by setting the cell's metadata hide_input=true
and installing a nbextension as discussed in issue #155.
Print Preview menu in the classical Jupyter
Finally to your question
Can I hide parts from the print preview or make a PDF with another tool?
The "print preview" button in the classical Jupyter interface is a shortcut for calling nbconvert
to generate a HTML file and redirect your browser to it. Therefore, similar configuration for nbconvert
to hide input as discussed above (in issue #155) can be used. This feature is implemented by jupyter_contrib_nbextensions
bundle and explained in the doc.