How to have pdf viewer in ruby
How can I embeded pdf viewer in ruby on rail?
Now I tried
<embed src="MyPdfDocument.pdf" width="500" height="375">
but it doesn't work. I used firebug and 开发者_如何学运维see the error like this
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIStreamListener.onStopRequest]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///home/bengasi/.mozilla/firefox/cmb1mbzu.default/extensions/firebug@software.joehewitt.com/components/firebug-channel-listener.js :: anonymous :: line 167" data: no] [Break on this error] this.listener.onStopRequest(request, requestContext, statusCode);\n
firebug-...stener.js (line 167)
If you are trying to display a PDF as an image, surrounded by HTML content... then a browser won't do that, and your problem is with the browser, not Ruby on Rails. You can link to a PDF, and display it whole, but you cannot embed it in another document.
You could simulate the effect (maybe, in some browsers) with an iFrame, but that is a HTML question, not a rails question... and you would possibly spend a lot of time making it work in all browsers.
You might find this useful:
http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html
精彩评论