View PDFs With Google Docs Viewer Bookmarklet [Update: Greasemonkey Script]
Google Docs has a webbased PDF reader that far outshines Adobes Reader, did you know? Did you also know that you can now view any online PDF document using this reader? Well you can, and using this freshly brewed bookmarklet, you can turn any hyperlink that points to a PDF into a comfy Google Viewer readable PDF. Drag one of these bookmarklet links to your bookmarks bar:
- Bookmarklet: View PDFs using Google Viewer
- Bookmarklet: View PDFs, TIFFs and PPTs using Google Viewer
Try it out; here’s a link to an online PDF, an online PPT file and an online TIFF file. Click the bookmarklet first, then click either a link.
[Update]: Since the Google Viewer also supports PowerPoint PPT and TIFF image files, I’ve added an alternative multi-bookmarklet (per request) that does all three filetypes.
[Update 2]: The bookmarklets should now work with uppercase file extensions. (Thanks Tyler).
[Update 3]: This greasemonkey script may work for you.
- Apple Vs. Woolworths Vs. Perspective
- View PDFs With Google Docs Viewer Bookmarklet [Update: Greasemonkey Script]
- New Stuff From Kent
- Elegant Finger
Does this work on the iPhone?
Any idea why the bookmarklet wouldn’t work with this site? http://pubs.acs.org/doi/full/10.1021/jm9010127
Hmm yes. That’s a use case I hadn’t considered.
The way the bookmarklet works is, it looks for any link to a file named “.pdf”. So it looks at the file extension to see what kind of link it is.
The PDF linked on that website you mention is located here: http://pubs.acs.org/doi/pdf/10.1021/jm9010127 — as you can see, no extension. So the bookmarklet won’t work. What you can do, however, is bookmark this URL:
http://docs.google.com/viewer
Then copy the PDF link you want to view and paste it in the input field. Then you’ll get this URL:
http://docs.google.com/viewer?url=http://pubs.acs.org/doi/pdf/10.1021/jm9010127
Which should work. I notice it doesn’t, but that seems to be a problem with Googles viewer!
Thanks, I appreciate your effort. Nice idea btw. I open up a ton of pdfs every day and get really tired of the load time and browser freeze.
Thanks again.
No problem.
Exactly my problem as well. It still boggles my mind how a web-based service can be better than using Adobes software.
Any chance this could work for .doc, docx, .xls, .xlsx, .ppt, .pptx too? That would be awesome.
I haven’t tested all of those file formats, but the viewer is supposed to support PDF, PPT and TIFF. I’m unsure about PPTX.
Here’s a modified version, that also supports TIFF and PPT:
View PDFs, TIFFs and PPTs using Google Viewer
Here are a few files for testing:
An online PPT file
An online TIFF file
If only there were a perfect PDF reader for Windows out there. I have a lot of saved PDF files. Foxit blows, Adobe’s Blows….
This is a brilliant solution for online PDFs though.
Well you could upload your PDFs to Google Docs. I know that’s totally not the solution you’re looking for, but that will work.
Doesn’t seem to work with this site: http://volokh.com/2009/09/30/background-reading-for-supreme-courts-new-14th2d-amendment-case/
It seems to be because all of the PDF links have the extension in all uppercase. I changed the extension in the bookmarklet to uppercase and then it works. I’m no expert in javascript, but it seems like you need to do a case-insensitive search for the “.pdf” string.
I believe this will work no matter what the case of the links:
javascript:var%20link,l=0;while(link=document.links[l++]){if(link.href.toLowerCase().indexOf(‘.pdf’)!=-1&&link.href.toLowerCase().indexOf(‘javascript’)==-1&&link.href.toLowerCase().indexOf(‘file:’)==-1){var%20newString=’http://docs.google.com/viewer?url=’+link.href;link.href=newString;}};void(null);
The only difference is the “toLowerCase()” before each indexOf function.
Excellent find, and thanks for the solution, I have added it to the post!
Can I ask…
Can someone (with brain bigger than me)
write a GreaseMonkey script to change the
PDF links to automatically call Google PDF?
Okay I’ve never done greasemonkey scripts before, but it seems to just be JavaScript files with a custom header. So here’s an attempt at a greasemonkey script.
If you test it, please let me know if it works for you.
(Paste the above code in a new textfile, and save the script somewhere and load the script as you would any other greasemonkey script).
Actually I just tested my own script in Google Chrome and it works for me. You have to call the file something like
pdflinks.user.jsfor it to work, though.Very nice! Simple and quite useful. Snappy PDF & PPT viewing is great! Thanks!
I just uploaded to userscripts.com a simple Greasemonkey script, pdf2googleviewer which converts all links to pdf files (or PDF files :) to view them through the Google Viewer.
Google Chrome Alpha under Linux does not yet render PDFs normally, but I was able to use this bookmarklet. Major timesaver. Thanks!
This is great!. This saves a lot for me :)
Hi,
Great bookmarklet! I wanted to use it in Opera Mini on my mobile phone, but Google Reader isn’t very good on a small screen. Instead I modified the script to use http://view.samurajdata.se/ instead. I thought someone else is interested in this as well so I post the solution here:
javascript:var%20link,l=0;while(link=document.links[l++]){if(link.href.toLowerCase().indexOf(‘.pdf’)!=-1&&link.href.indexOf(‘javascript’)==-1&&link.href.indexOf(‘file:’)==-1){var%20newString=’http://view.samurajdata.se/ps.php?url=’+link.href;link.href=newString;}};void(null);
If you want more info about boomarklets in Opera Mini, you can look at http://wapreview.com/blog/?p=255. I posted the solution there as well together with a link to this site. Hope you don’t mind!
Thanks Joen and Joel :) That works also for even more pdf conversion services like pdf to html at pdfdownload.org that is also quite nice alternative for Opera Mini users.
javascript:var%20link,l=0;while(link=document.links[l++]){if(link.href.toLowerCase().indexOf(‘.pdf’)!=-1&&link.href.indexOf(‘javascript’)==-1&&link.href.indexOf(‘file:’)==-1){var%20newString=’http://www.pdfdownload.org/pdf2html/pdf2html.php?images=yes&url=’+link.href;link.href=newString;}};void(null);
Adding encodeURI to the link.href will help with messed up file names like tps%20report.pdf.
I posted the Bookmarklet but there were problems, so adapt from the Greasemonkey script.
Greasemonkey:
var link, l = 0; while (link = document.links[l++]) { if (link.href.toLowerCase().indexOf('.pdf') != -1 || link.href.toLowerCase().indexOf('.ppt') != -1 || link.href.toLowerCase().indexOf('.tiff') != -1 || link.href.toLowerCase().indexOf('.tif') != -1 && link.href.indexOf('javascript') == -1 && link.href.indexOf('file:') == -1) { var newString = 'http://docs.google.com/viewer?url=' + encodeURI(link.href); link.href = newString; } }I love the wide range of tools that have become available to us through Google. Each month there is a new tool or software that Google is releasing in beta testing. Google Insight has been my favourite and I believe has taken the time out of keyword research. Thanks
Cool, thanks!