iFraming External PDF Files (Currently empty element loaded)

Current Problem: iFraming external PDFs (with embed src file link) is Unavailable

While trying to embedding/iframing PDF files into Obsidian, it shows nothing but a blank frame in the preview mode - a blank element in the iframe html elements.

The following is the inspection of elements in dev mode.

iframe code used for example

<iframe src="https://d30b7srod7pe7m.cloudfront.net/uploads/2020/08/Figure_Managing-acute-asthma-in-adults_web.pdf"></iframe>

Proposed Solution

Hoping Obsidian could be as able to render out the elements in PDF files, just as web browsers does in comparison:

4 Likes

Agreed, and it would be great to be able to embed external PDF files stored locally on the PC (like we can do for images and videos)

Besides iframes, some other ideas for syntax could be:

In markdown

![PDF name](<link-to-PDF>)

Using HTML <object>

<object data="link-to-file" type="application/pdf" width="100%" height="650"></object>

Using HTML <embed>

<embed src="link-to-pdf" type="application/pdf"/>

Related discussions:

https://www.reddit.com/r/ObsidianMD/comments/12xn5sz/how_do_you_link_to_external_pdf/

I think I found a fix. Use this syntax for your link:

<iframe src="http://docs.google.com/gview?url=https://example.pdf&embedded=true" style="width:100%; height:1000px;" frameborder="0"></iframe>

The reason it works this way is that embedding it just using plain iframe triggers CORB (cross origin read blocking), which is a security protocol that prevents some code from running in your browser for protection. However, you know your code is just for showing a PDF and that the PDF is safe, so you use google pdf viewer to open the PDF. I found the syntax for doing so here.

I wish someone makes this a plugin like the convert-url-to-iframe. I think that the implementation will be very similar.

Example