microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.29k stars 290 forks source link

Cannot download pdf format from renderer #16111

Open alex180500 opened 8 months ago

alex180500 commented 8 months ago

When trying to download a Cairo plot from the jupyter notebook renderer (image/svg+xml from ms-toolsai/jupyter-renderers) I'm unable to download the pdf format (I click save as pdf but nothings happens). The SVG save file works fine.

When opening the Plots using "Expand image" button there is another save button which can save in SVG, PNG (both working fine) and also PDF which gives an error

19:29:06.896 [info] exporting plot...
19:29:14.669 [info] Attempting pdf write...
19:29:14.669 [error] [TypeError: Invalid host defined options
    at iL (~\.vscode\extensions\ms-toolsai.jupyter-2024.1.1-win32-x64\dist\extension.node.js:362:62189)
    at kI.exportPlot (~\.vscode\extensions\ms-toolsai.jupyter-2024.1.1-win32-x64\dist\extension.node.js:362:61723)]

This is the code I used to replicate the bug (it uses the igraph library with pycairo)

import igraph as ig
graph = ig.Graph.Lattice((3, 3))
ig.plot(graph, layout="grid")

Versions vscode 1.86.1 jupyter v2024.1.1 jupyter notebook renderers v1.0.17 python-igraph 0.11.3 pycairo 1.25.1

alex180500 commented 8 months ago

Another issue arises when trying to rerun the cell. If I try to open again the "Expand image" I get the following error:

19:44:13.823 [error] No SVG or PNG Plot to open ~\##myfolder##\issue_igraph.ipynb, id: 2e3711a7-dbf9-4bce-be8a-fae6257d88f5

I first have to clear the output then I have to click again and it works. This issue is not present for the matplotlib inline rendering.

DonJayamanne commented 1 week ago

I'm very sorry for missing this issue, I can replicate this issue at my end as well, Will look into this.