Surendra Sharma

Surendra Sharma

Search This Blog

Thursday, August 29, 2013

How to show different type of documents in ASP.NET webpage

To view different type of file, particular software is required.

Suppose if your website have word documents, client must have MS-Office software to view it. Similarly to show PDF, Adobe Acrobat is required.

In this way there can be thousands type of file format, will you install all these software to view particular type of file?

Problem. Very serious problem.

How nice if I use only one tool and can view any file as below




What is the solution?

Use online document viewer.

The beauty of online viewer is that no need to purchase different type of software on Web Server or client side.
You don't need to upload your file to their server.

The one online document viewer that I like is http://www.prizmcloud.com/

They allow to embed document viewing in your site, blog or social media. They supports  300+ file types, play self-running slideshows, all while keeping them on your server and in your control and no installation required.

It also supports various online features like zoom , print, navigate, copy , save , fill screen, search etc.

How to use it?

First register free yourself on http://www.prizmcloud.com/register.html.

After successful registration you will receive your KEY.

Now we can use their service by passing KEY and document URL as a query string to their cloud server at http://connect.ajaxdocumentviewer.com.

Example 1 :- Use below URL with query string as below



Where
·         key = Your key number
·         document = Any valid URL of document

Other supported optional query strings are

·         viewertype = flash or HTML5
·         viewerheight = viewer height in pixel
·         viewerwidth = viewer width in pixel
·         printButton = Yes or No
·         toolbarColor = colour code like CCCCCC



How to use it in ASP.NET webpage?

Use frame tags in your ASP.NET page like

<iframe width="700" height="650" src="http://connect.ajaxdocumentviewer.com/?key=123456789&document=http://www.cdc.gov/phpr/documents/11_225700_A_Zombie_Final.pdf">
</iframe>
         
Use below ASPX code for displaying PDF file in document viewer as shown in above image

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <iframe width="700" height="650" src="http://connect.ajaxdocumentviewer.com/?key=123456789&viewertype=flash&document=http://www.cdc.gov/phpr/documents/11_225700_A_Zombie_Final.pdf&printButton=Yes&toolbarColor=CCCCCC">
            <p>Your browser does not support frames.</p>
        </iframe>
    </div>
    </form>
</body>
</html>


Please leave your comments or share this tip if it’s useful for you.

No comments:

Post a Comment