Print data to pdf file

Hello,
I am looking for a way to create a pdf and print some data(not just graphics). I currently use matplotlib.backends.backend_pdf but I am a bit limited when I want to create pages with some data (text + tables)
Any way I can use some python module or similar?
Thanks in advance
Juan

Hello Juan,

you can export the notebook as PDF

you can put there in the notebook all the information that you need using the markdown cells, code cells etc…

this works for you?

Cheers
Omar.

Hello Omar,
Thanks for the answer. Unfortunately it doesn’t work for my case. I’d just need to print some of my outputs.
I used also nbconvert but I’d need something that is executed by the code itself.
Cheers,
Juan

Hello Juan,

this is a very particular use case, I did not found a direct way to do it,
looks like you will need to do an extra development to reach it.

I found this magic that may can help you %%capture

this allows to you to save the output in a variable, in that example the variable is out
you need to figure out how to save it in a PDF.

Cheers
Omar.

Hello Omar,
That magic is really a good help.
Thanks,
Juan

1 Like