Text wrapping in Notebook

I’m missing the context here? You first just mention using Jupyter Notebook (and presumably your title) and then are talking saving it as PDF. Those are two vastly different things. Where do you really need wrapping of code here?

Do you just need to view it ‘statically’ after-the-fact so the code isn’t cut off? (Like PDF) Then use nbviewer. See here for more about that with links to examples. If the content needs to be private you can use nbpreview, see more explanation about that at the top here.

A lot of these questions arise because there’s a lot of way to work in Jupyter with a lot of languages. Are you using Python? Then you can use black in conjunction with your notebook. You can just write and let it format later. This way your code is more portable in the end. See for example nbQA. Or see how with Jupytext you can pipe your notebook code to black here.

There’s lot of other options that make it hard to understand exactly what you seek at this point:

Code cell wrapping in Notebook help:

Code cell wrapping for Jupyter Notebook use in VSCode hlep:

Wrapping in JupyterLab help: