dylkot
dylkot

Reputation: 2475

Embedding local pdf image in jupyter notebook with IFrame just produces a gray box

I am trying to embed a local PDF image file into a jupyter notebook run in jupyter-lab as follows:

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

But this just produces a gray box: Output of attempt to display pdf

Any idea what is going on or how I can fix this? I am using Python 3.6, jupyter==1.0.0 jupyterlab==0.32.1 matplotlib==2.2.2 ipython==6.5.0

Upvotes: 9

Views: 5801

Answers (2)

J. Hiltz
J. Hiltz

Reputation: 31

If downgrading is an option, downgrading to the following versions allow pdfs to be displayed in chrome:

pip install tornado==4.5.3 notebook==5.1

or with Anaconda:

conda install tornado=4.5.3 notebook=5.1

Alternatively installing the following plugin will also solve the issue: https://chrome.google.com/webstore/detail/pdf-viewer/oemmndcbldboiebfnladdacbdfmadadm?hl=en

Upvotes: 0

Polv
Polv

Reputation: 2208

What browser are you using? I was using Safari on MacAir, and had this problem.

Changing the browser to Firefox solved the problem.

Upvotes: 2

Related Questions