I use the gem pdfjs_viewer-rails for my Rails application and Carrierwave to store my PDF's on Amazon S3. When i link to a PDF-url i with the mounted route specified by the gem:
# routes.rb
mount PdfjsViewer::Rails::Engine => "/pdfjs", as: 'pdfjs'
and my view:
#_johannes_writing.html.erb
<%= link_to pdfjs.full_path(file: johannes_writing.pdf.url) do %>
<h3>Read <%= johannes_writing.title %></h3>
<% end %>
i am redirected to the correct page but the design and function is totally off. I have to reload the page to get the proper functionality (se image below )
Now it get strange
If i go back in my browser when i'm on the pdf-view-page without reloading, the css is changed for my #_johannes_writing.html.erb view to the dark-background as the pdf-view.
If i set my layout to false in my controller, everything is working as it should. The PDF is showing the first time without reload and nothing is changed on a back. So somehow my layout CSS and HTML are interferring with the GEM even though the pdf-view is on its own route?
What can be the cause of this? I tried different opportunities with Iframe integration on its own view (like the gems dokumentation suggests), but nothing helped. Any help will be appreciated.
Best Peter
Link to project: http://inger-exner.herokuapp.com/johannes_writings (push the word "Læs" under the button to go to PDF-viewer)