'How to embed pdfs files in jupyter notebook on Github
So I have few pdfs files which I uploaded to my repository on Github. Now I am uploding a jupyter notebook file in the same directory as the pdf files on github and want to display pdfs inside the jupyter notebook.
I used the following method to embed pdfs in a notebook.
from IPython.display import IFrame
IFrame("https://github.com/user/first.pdf", width=900, height=800)
Now the same thing works when I do this on my local laptop where I store the pdfs in a directory and link that to the jupyter notebook file on my laptop. I can see the pdfs inline too.
However when I do the same thing on Github, it doesn't show the pdfs and get the following thing:
So am not sure why it is not able to link the pdfs stored on the same repository on github and display them while it works on my local system
Any help?
Thanks
Solution 1:[1]
In the case of Github, it is because of X-Frame-Options restriction.
See: iframe not rendering in ipython-notebook
As a workaround, you can try using rawgit.com:
Example:
https://raw.githubusercontent.com/mozilla/pdf.js/raw/master/test/pdfs/S2.pdf (does not work)
https://rawgit.com/mozilla/pdf.js/master/test/pdfs/S2.pdf (works)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | prusswan |

