Reputation: 25023
In my notebooks I sometimes have
from IPython.display import display, HTML
...
display(HTML('<h3>The %s is important!</h3>'%question_of_the_day))
...
but when I later convert the notebook to .pdf
(with the intermediate step of a LaTeX file) what I get in the .pdf
is just
<IPython.core.display.HTML object>
My question is, is it possible to convince jupyter nbconvert --to pdf ...
(and ultimately to convince pandoc
) to convert the snippet of HTML code
that I had programmatically inserted in an output cell?
Upvotes: 8
Views: 1731
Reputation: 8588
Based on this github issue (which is still open at the time of writing) the PDF export goes through Latex which makes it hard to include HTML. Only trivial HTML works. In my experience not even markdown tables work well.
My workaround now was: File>DownloadAs>HTML, open the downloaded html with Chrome browser and say print. Select Destination "Save as PDF".
Upvotes: 3