Question

How can i display word documents, pdf documents in the browser using files from the web folder? So if a user uploads a pdf report and wants to see it in the browser, how can i allow that to happen? Can HTML5 be of use?

Was it helpful?

Solution

From your comment about displaying images, it seems like what you want is to embed the PDF or Word file in the page. The easiest thing to do is use an iframe, like so:

<iframe src="http://myserver.com/userUploads/foobar.doc" width="500px" height="500px">
</iframe>

However, the different widgets for different document types will look substantially different and may not provide all the functionality you would expect (as in this example). In addition, not all browsers will be configured with a way to display the document inline - some will prompt the user to download the file.

Uploading the documents to something like Scribd will provide a more uniform experience across document types and browsers; however, depending on how important it is for these documents to be private, Scribd may not be a good solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top