Note
Google Docs Viewer is gone, therefore nothing here will work. (2015-12-10T03:08:02Z)
More than a year ago, I wrote a post about how to view local PDF file. To be honest, I never actually used that script, I have a bookmark for viewing PDF online for very long time even before I wrote that script. I don’t download PDF when I need to open a PDF file, just directly view it using Google Docs Viewer.
If you are a Firefox user, it’d be great to know the keyword and %s in bookmarks. Keyword of bookmark allows you to access the bookmark by just typing it in address bar, %s in bookmark URL will be replaced with the string you put after the keyword when you open a bookmark using address bar.
To show you how to use bookmark, first, create a bookmark with URL as follows:
https://docs.google.com/viewer?url=%s
and set keyword to gdv.
Next, find a random PDF link online and type in the following text in address bar:
gdv[Space]http://example.com/foobar.pdf[Enter]
Google Docs Viewer will show you the document if it’s not get blocked. I have seen one or two websites actually blocks Google Docs Viewer.
You can have embedded version with the following URL, which has less controls:
https://docs.google.com/viewer?embedded=true&url=%s
For me, as a fan of Pentadactyl, after I yank a URL of PDF, I just type in:
[o]gdv[Space]http://example.com/foobar.pdf[Enter]
If you are smart, you should have learned you can set some keywords for your most visited bookmarks with single letter or two. You don’t need to go through your bookmark bar, you just type the keyword and press enter.
Note
Thanks azuwis for the great tip of using hints in the comment below, here is the embedded code. (2012-06-26T09:38:22Z)
Press ;d to get the hints if links are PDF, DOC, etc.
For pentadactyl, I use:
ReplyDeletejs <<EOF
hints.addMode("d", "Open link using google docs", function (elem)
dactyl.open("https://docs.google.com/viewer?url=" +
encodeURIComponent(elem.href), dactyl.NEW_TAB), null,
["a[href*='.pdf']", "a[href*='.doc']", "a[href*='.ppt']",
"a[href*='.odp']"]);
EOF
and then use ;d
nice tip, I added it into the post.
ReplyDelete