Show .docx (.doc) in browser without loading in php

Is there an alternative way to view a file (locally / online) in PHP ? Since I want to display the .docx(.doc) file in my browser, but it continues to load it. So who has the code for this? I keep looking for some other source code but no luck. I tried to use Iframe but still keep uploading the file. Thanks!

+7
source share
3 answers

After much research, I found the best solution for displaying almost all types of documents in a browser using an iframe.

Solution - Google Docs Viewer

Just use an iframe as below, and replace the document URL in it.

 <iframe src='https://docs.google.com/viewer?url=ENTER URL OF YOUR DOCUMENT HERE&embedded=true' frameborder='0'></iframe> 

By replacing the sample URL for the .docx file, the above code becomes.

 <iframe src='https://docs.google.com/viewer?url=http://calibre-ebook.com/downloads/demos/demo.docx&embedded=true' frameborder='0'></iframe> 

By replacing the sample URL for the .pdf file, the above code becomes.

 <iframe src='https://docs.google.com/viewer?url=http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf&embedded=true' frameborder='0'></iframe> 

Note. The document that needs to be displayed in the browser must have the correct URL and must be publicly accessible , since Google needs to get and display the document, the process will fail if the document is private, and you will see an iframe without PRELIMINARY VIEWING AVAILABLE

+7
source

I looked at some MS Office documents at www.dropbox.com . I just looked, the tool used is called QuickLook Framework . It converts the docx / doc document to pdf and displays the pdf document on the website. But this is an iOS library.

If your documents are publicly available, you can use the Office Web View or the Google Docs viewer .

I have never used PHP to view Word documents on the Internet and have never seen a complete tool for this. But to write a parser, of course, perhaps the question is how much formatting do you want to keep? If playing formatting is acceptable, you can try starting with answers to similar questions .

+3
source

I don’t know if this topic is closed or what, but for Google View this code works perfectly

 <iframe src='//docs.google.com/gview?url=URLOFDOC.docx&embedded=true' frameborder='0'></iframe> 
0
source

All Articles