I’ve created a Python script which is quite complex but it can be run directly in any Jupyter notebook.
The structure of my Jupyter notebook is:
<Cell with %run <myscript.py> >
In that script I’ve got some print(f’…’). However, I don’t know why, when I use Nbconvert by command line to create a PDF with webpdf, I get a result like:
PAGE 1 = MarkDown1 and A LOT OF WHITE SPACE
PAGE 2 and following = all the prints from %run <myscript.py> in the right sequence
…
LAST PAGE = MarkDown2
I don’t understand why the Nbconvert –to webpdf command should create a new page after running myscript.py, even if there’s a lot of white space after the first MarkDown.
The print() that are integrated in myscript.py are usually one or two lines of f-string, so the renderer could, theoretically, put some of these prints just after the first MarkDown, instead of creating a new page.
I don’t understand this behavior, and also I don’t understand on which base webpdf decides to create a new page for printing or not.