HOW TO open a PDF or Word .DOC file within the browser

I have seen this uncommon question come up on the Forums on how to make a PDF or a Word document show up within a browser rather than having that file open up in a separate window through Adobe Reader or MS Word (as the case may be). I realized while trying out Google Viewer that it can be used programmatically in your own pages to force  a .PDF or .DOC link to show up within the browser. Moreover with this technique, it does not also matter if the end user has a PDF or Word document viewer installed on his comp.

Here is how Google Viewer typically works. The URL of the .PDF or .doc file to be opened within the browser has to be passed to Google Viewer as a querystring value -
http://docs.google.com/viewer?url=http://www.hud.gov/buying/checklist.pdf

Suffixing an absolute URL of a PDF or Word document as a querystring value does the trick.

Update (4/Feb/2013): Google Docs/Drive viewer currently helps you preview over 16 different file types, so this trick can be extended to those file types as well.

Comments

  1. These means that the doc which we want to view need to be hosted on the internet? The problem is what if the doc that i want to be viewed were hosted in the intranet?

    Any suggestion?

    ReplyDelete

Post a Comment

Popular posts from this blog

Maven Crash Course - Learn Power Query, Power Pivot & DAX in 15 Minutes

"Data Prep & Exploratory Data Analysis" course by Maven Analytics

Oracle Cloud Infrastructure 2024 Generative AI Professional Course & Certification Exam (1Z0-1127-24)