senny / pdfjs_viewer-rails

PDF.js viewer packaged as a Rails engine.
MIT License
114 stars 174 forks source link

iframe example? #70

Open travisLilleberg opened 3 years ago

travisLilleberg commented 3 years ago

Hello,

I'm trying to use the viewer inside an iframe and I'm just getting a white box. Could you provide a working example of an iframe using the helper method provided?

My iframe: <iframe srcdoc="<%= pdfjs_viewer(pdf_url: pdf, style: :minimal) %>"></iframe>

I've also tried escaping the quotes, which loads the html, but the javascript and css don't load: <iframe srcdoc="<%= pdfjs_viewer(pdf_url: pdf, style: :minimal).gsub('"', '&quot;') %>"></iframe>

Thanks for any help!

summer-cook commented 7 months ago

@travisLilleberg did you ever figure out how to do this? I get the same issue when trying to use the helper :(

travisLilleberg commented 7 months ago

@summer-cook Hi Summer,

Unfortunately I no longer work at the place I was doing this for and I don't remember what we did, but it looks like we forked the repo and made a few changes:

Forked repository: https://github.com/TuftsUniversity/pdfjs_viewer-rails

The commit we added: https://github.com/devisaah/pdfjs_viewer-rails/commit/d624c83a6fa9e8338989b9ec813caab288d437af

You can try using our fork and see if that resolves the issue, but beyond that I honestly don't remember. Hope this helps!