Noscope is a bi-weekly journal serving up snacksized portions of pointless stuff since 2001.
I also do freelance design and usability via dejligt.com

View PDFs With Google Docs Viewer Bookmarklet [Update: Greasemonkey Script]

    14:51 on October 06th, 2009 , ,

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:

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.

43 Comments

  1. dog_race tweeted this.
  2. blub_blah tweeted this.
  3. kamiu tweeted this.
  4. desk_stage tweeted this.

Pings

  1. 快速使用 Docs Viewer 查看网站上的PDF文件 | 谷奥——探寻谷歌的奥秘
  2. Google Docs Viewer Bookmarklet Makes PDFs Less Freeze-y [Bookmarklet] · TechBlogger
  3. 快速使用 Docs Viewer 查看网站上的PDF文件 - Jeff-Chen.Com
  4. 重いPDFやPPTファイルもサクッと開けるGoogle Docs Viewer ブックマークレット - WEBマーケティング ブログ
  5. Google Docs Viewer Bookmarklet Makes PDFs Less Freeze-y | Lifehacker Australia
  6. Wat boeit mij donderdag 8 oktober 2009
  7. Iain Cheyne (icheyne) 's status on Saturday, 10-Oct-09 20:17:00 UTC - Identi.ca
  8. Bite my bytes
  9. Leggere PPT e PDF online tramite Google Docs Viewer | Googlisti.com
  10. RSS Week #70: letture per il weekend - Matteo Moro
  11. *blend - *blending technology and blending families » Google Docs Viewer Bookmarklet Makes PDFs Less Freeze-y [Bookmarklet]
  12. westXdesign.com - Computer and Internet Solutions » Google Docs Viewer Bookmarklet Makes PDFs Less Freeze-y [Bookmarklet]
  13. Abrir archivos PDF, PPT y TIF en internet con Google Docs Viewer | Materia Geek
  14. Computerk(r)ampf.de » Blog Archive » PDFs direkt im Browser anzeigen
  15. Bookmarks | Call me Yaisog.

Comments

  1. Shal says:

    Does this work on the iPhone?

  2. J (subscribed) says:

    Any idea why the bookmarklet wouldn’t work with this site? http://pubs.acs.org/doi/full/10.1021/jm9010127

  3. J (subscribed) says:

    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.

  4. Jeff O Hara says:

    Any chance this could work for .doc, docx, .xls, .xlsx, .ppt, .pptx too? That would be awesome.

  5. Brandon says:

    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.

  6. Tyler (subscribed) says:

    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.

    • Tyler (subscribed) says:

      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.

    • Joen says:

      Excellent find, and thanks for the solution, I have added it to the post!

  7. Rick says:

    Can I ask…
    Can someone (with brain bigger than me)
    write a GreaseMonkey script to change the
    PDF links to automatically call Google PDF?

    • Joen says:

      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.

      // ==UserScript==
      // @name           View PDFs, PPTs and TIFFs in Google Viewer
      // @namespace      Google
      // @description    This script ensures that all hyperlinks pointing to PDFs, PowerPoint docs and TIFF images are opened using Google Viewer.
      // ==/UserScript==
       
      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=' + link.href;
      		link.href = newString;
       
      	};
       
      };

      (Paste the above code in a new textfile, and save the script somewhere and load the script as you would any other greasemonkey script).

    • Joen says:

      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.js for it to work, though.

  8. Gary says:

    Very nice! Simple and quite useful. Snappy PDF & PPT viewing is great! Thanks!

  9. Patrick says:

    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.

  10. Iain Cheyne says:

    Google Chrome Alpha under Linux does not yet render PDFs normally, but I was able to use this bookmarklet. Major timesaver. Thanks!

  11. chanux says:

    This is great!. This saves a lot for me :)

  12. Joel (subscribed) says:

    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!

  13. Serola says:

    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);

  14. ftvs says:

    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;
    	}
    }
    
  15. Van says:

    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

Leave a Reply

Have something to say? Jump right in!

(required)
(required)