I want to open a DOC or Docx file (Generally MS Office files) in the browser. Can anyone tell me how to complete this task. I am working on my CakePHP Project.
Any Help will be appreciated.
Thanks
you can't show docx file directly on browser.
so you can use google doc viewer for it . mostly format supported by google doc Viewer.
To render pdfs in a browser have a look at pdf.js: http://mozilla.github.io/pdf.js/ Pdf.js renders pdfs on client side, most browsers are supported. For doc and docx I'm pretty sure this can only be done by converting them on server side to another viewable format or using googles doc viewer (be careful there are limitations)
To display the contents of doc files in browser, you can covert the doc file to html (I use zend livedocx for this) on server side and then display the converted html. An example can be seen here.
Browsers have no native way of opening documents such as DOC, PDF, ODT etc. However from the history point of view the managed to do it via usage of plugins (Adobe Acrobat, Open Office).
Some browsers (e.g. Firefox with PDF.js) have included some of these plugins in order to provide more smooth user experience when opening documents. Generally speaking most of the browsers now step back from plugins. But still there are plenty to be used, for example WebODF for Libreoffice integration.