Tip: Embed any document on your blog using Google Docs Viewer
January 12, 2012 in Tips
While Google Docs makes it dead simple to embed any document created in Google Docs, sometimes you might want to embed a document that is not saved in your Google Docs account. To do so, you can use the Google Docs Viewer, which will look familiar to Gmail users who choose to “Preview” attachments before downloading them. The Docs Viewer is very simple to use, consisting of a simple HTML iframe and any document URL.
The basic HTML code looks like this:
<iframe src="http://docs.google.com/gview?url=YourDocumentURLGoesHere&embedded=true" style="width:600px; height:500px;" frameborder="0"></iframe>
All you need to do is copy the code above and replace YourDocumentURLGoesHere with the actual URL of your file (for example: http://clevelandhistory.org/files/2012/01/csu-web-palette.pdf). Adjust the height and width as needed.
Here’s an example using this PDF file:
Here’s another example using this PPT file:
The Docs Viewer does not support every file type, though it does support the most common ones, including PDF, PPT, DOC, and even TIFF (you can also embed Excel (XLS) files using this method, though they will be converted to PDF format).