Read PDF files in Web without Adobe Plugin
Is it possible to for a web browser to read a pdf file generat开发者_Python百科ed by a Java EE Web application without installing the Adobe reader plugin? Isn't there any native pdf reader in the browser? What advise can you give?
Chrome has a built in PDF reader, but other browsers do not (as far as I'm aware).
You could use Google Docs to provide a "view" link for PDFs. For example, http://bit.ly/oQCsTe is a (shortened) link to a PDF file. To easily allow users to view this in Google Docs, make a link like this: http://docs.google.com/viewer?url=http://bit.ly/oQCsTe
Alternatively, if you're okay with having users install a PDF reader, but dislike Adobe reader, you can recommend an alternative like SumatraPDF or Foxit Reader.
Finally, if you want to have your users download PDFs instead of view them in the web browser, in your HTTP request response, set the content-type
header to application/octet-stream
and set the content-disposition
header to attachment
.
Edit: Some more ideas:
- I suppose if you're willing to rely on your users having other plugins installed, you might be able to fake it using a Java PDF viewer applet (maybe ICEpdf, or perhaps another one from this list of Java PDF tools) or using Flash (e.g. PDF2SWF, as mentioned in how can i show doc or rtf or pdf in flash player or in none editble format)
- Also along those lines you could convert the PDF to a format you know users will be able to read (for example, if your document is only a page long, PNG or possibly SVG).
- Perhaps you could do something fancy using Javascript - a quick google turned up an introduction to PDF.js, which seems to still be an active project, but that's all I know about this approach.
精彩评论