notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Embedded images do not print if referenced as html

Open callegar opened this issue 4 years ago • 1 comments
trafficstars

Describe the bug

Notebooks can have embedded images. These images work just fine if they are referenced via markdown. However if they are referenced using html they display fine but they do not print.

As an example, suppose that you have a notebook and that you insert in a cell an image named new.jpg. This gives you the following markdown:

![new.jpg](attachment:new.jpg)

that works just fine.

However if you try to use that figure changing the above into what should be the equivalent html (e.g. to get more control over the image size, centering, etc.) as in

<div><center>
<img src="attachment:new.jpg">
</center></div>

that works correctly on screen but when you try to print using the File->Print feature, the image is broken in the preview and in the printout.

The issue is present both with jupyter notebook and with jupyter lab.

callegar avatar Sep 28 '21 15:09 callegar

As a workaround, because you are using html anyways, you can use base64 encoded images inline. This is extremely ugly when you expand the cell to edit it, but at least it works.

callegar avatar Jul 26 '22 17:07 callegar