How to use Google document viewer in asp.net - Free Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server,WCF,Entity framework snippets and tutorial

How to use Google document viewer in asp.net

In this article I am going to explain how to use Google document viewer in asp.net website.


Description:
I want to show document i.e. PDF, word doc, Excel and PPT file. I am going to use Google document viewer to show document.

 Implementation:
To display documents using Google document viewer you have to iframe.  Here is the sample how to use this:

<iframe src="http://docs.google.com/viewer?url= website_url&embedded=true" style="width: 100%; height: 550px;" ></iframe>

Example to embed document:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
<iframe src="http://docs.google.com/viewer?url= http://www.aspmantra.com/upload/pdf.PDF&embedded=true" style="width: 100%; height: 550px;" ></iframe><br />
 <iframe src="https://docs.google.com/viewer?url=http http://www.aspmantra.com/upload/sample.doc&embedded=true" frameborder="1" style="width: 100%; height: 550px;" ></iframe><br />
 <iframe src="http://docs.google.com/viewer?url= http://www.aspmantra.com/upload/sample.xlsx&embedded=true" style="width: 100%; height: 550px;" ></iframe><br />
<iframe src="http://docs.google.com/viewer?url= http://www.aspmantra.com/upload/SamplePPTX.pptx&embedded=true" style="width: 100%; height: 550px;" ></iframe>
    </div>
    </form>
</body>
</html>

Output:

How to use Google document viewer in asp.net



*Note: Google document viewer will not display files uploaded to your localhost. It will show document from a URL.

  


What do you think about this article?

If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.

Share this

Share on FacebookTweet on TwitterPlus on Google+


EmoticonEmoticon