문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top