使用iFrame将本地pdf图像嵌入jupyter笔记本中只会产生一个灰色框

时间:2018-08-21 13:36:47

标签: ipython jupyter-notebook jupyter

我正尝试将本地PDF图像文件嵌入到在jupyter-lab中运行的jupyter笔记本中,如下所示:

from IPython.display import IFrame
plot_fn = 'example_data/example_cNMF/example_plot.pdf'
IFrame(plot_fn, width=600, height=400)

但这只会产生一个灰色框: Output of attempt to display pdf

知道发生了什么或如何解决?我正在使用Python 3.6,jupyter == 1.0.0 jupyterlab == 0.32.1 matplotlib == 2.2.2 ipython == 6.5.0

2 个答案:

答案 0 :(得分:1)

您使用的是哪种浏览器?我在MacAir上使用Safari时遇到了这个问题。

将浏览器更改为Firefox即可解决问题。

答案 1 :(得分:0)

如果可以选择降级,则降级到以下版本可将pdf显示为chrome:

pip install tornado==4.5.3 notebook==5.1

或使用Anaconda:

conda install tornado=4.5.3 notebook=5.1

或者安装以下插件也可以解决此问题: https://chrome.google.com/webstore/detail/pdf-viewer/oemmndcbldboiebfnladdacbdfmadadm?hl=en

相关问题