Use Google Docs to view PDF and PPT from inside your Broser
Google Docs recently added a new functionality where you can embed PDF ,PowerPoint or Tiff in a web page.This does not require any downloading of the file.This is particularly helpful for the blog owners and webmasters .They can now embed the pdf instead of just showing a link to download the file.
So how do you build your own urls if you want to embed a PDF or a PPT?
You will use a format as shown below to embed the documents.
<iframe src="http://docs.google.com/viewer?url=<your Encoded URL here>&embedded=true" width="600" height="780"></iframe>
The above format accepts two parameters "url" and "embeded".The parameter url contains the encoded version of the actual url.
To display the documents directly in browser using google docs viewer ,you will use a format as given below.
http://docs.google.com/viewer?url=
If you upload a PDF to Google Docs it takes the form as given below.
http://docs.google.com/fileview?id=0Bx1JSIWei_LIMWNiMzFhZWEtZjkzYS00MzI4LWIxMWMtZDgzMzIyNDg5Y2M5&hl=en
So if you use the above URL to embed the document in Google Docs Viewer it wont work because the Google Docs Viewer cant recognize the format as the URL does not have ".pdf". I have found a way to overcome this.The below embeded document was uploaded to Google Docs directly.
The format I have used to embed the uploaded Google Docs is given below.
<iframe frameborder="0" width="100%" height="500" id="gview" src="http://docs.google.com/gview?a=v&pid=explorer&chrome=false&api=true&srcid=0Bx1JSIWei_LIMWNiMzFhZWEtZjkzYS00MzI4LWIxMWMtZDgzMzIyNDg5Y2M5"></iframe>
Replace the scrid with your Google Docs id.
Zoho and Scribd also offer similar functionality along with more features.The problem with Scribd is that it uses Flash to render documents and some of the Mobile Phones still do not support Flash.In Zoho you are forced to upload the document before seeing it.
We will certainly see more features getting added to Google Docs viewer in coming weeks.One feature I would like to see is an API where people can send search parameters also.Now get started with the Google Docs Viewer.