0
我試圖讓fancybox在iframe中顯示pdf,現在它只是將pdf下載到用戶計算機上,我想讓它在模式/ fancybox內的瀏覽器中可見。在載有carrierwave的rails3的fancybox中顯示pdf?
目前的觀點是:
<% for issue in @issues %>
<tr>
<td><%= issue.date %></td>
<td><%= link_to "view pdf", issue.pdf_url, :class => "fancybox" %>
<td><%= link_to "Show", issue %></td>
<td><%= link_to "Edit", edit_issue_path(issue) %></td>
<td><%= link_to "Destroy", issue, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
我想,有一種方法,我可以使用谷歌文檔查看器中發現here但我不完全知道我怎麼會創建鏈接?以及我將如何在本地測試,因爲如果我從本地主機運行,查看器顯然不能看到pdf。
哪些解決方案可用於導軌?我想在本地主持pdf。
還有一種方法可以使用rmagick生成第一頁的png或jpg用作預覽嗎?
更新:
我繼續用這個作爲我的鏈接試圖但是它拉一個錯誤。
<%= link_to "view pdf", 'http://docs.google.com/gview?url=#<%= issue.pdf_url %>', :class => "fancybox" %>
誤差
/app/views/issues/index.html.erb:10: syntax error, unexpected $undefined, expecting ')'
...);@output_buffer.safe_concat('\', :class => "fancybox" %>
... ^