December 3, 2009

My first Chrome Extension – Simple Print

I’ve been really enjoying Google Chrome lately.

I had been a big fan of Firefox for many years, but after playing around for a while with the dev channel versions of Chrome -called Chromium- I have come to really appreciate the speed increase I get using Chrome/Chromium instead of Firefox. Now that Chrome has the ability to have addons – extensions as they’re called in Chrome – I have very little need for Firefox anymore.  There are however some things from Firefox that I miss. Small things, like the ability to have a “Print” button on your toolbar.  So I scrounged around a bit and after some trial and error I came up with my first chrome plugin “Simple Print”

It is very, very simple.  All it does it put a print button on your chrome bar.  You click the button and it brings up a print dialog.  That’s it.  It may get more features eventually, but for now, It is just a print button.

Simple Print Screenshot

If you’re interested you can download and install it here!

Simple Print
Simple Print

UPDATE:  I’m on the official Google Chrome Extensions Gallery

Note that you will need to have the beta or  dev channel version of Chrome installed.  you can find that here http://www.google.com/landing/chrome/beta/ or here http://www.chromium.org/getting-involved/dev-channel

I have tested this on Ubuntu 9.10, Windows XP, Windows Vista and Windows 7 it seems to work on all of them.

It’s a super simple addon, but if you’re interested in the source code drop me a line. The icon used came from the “humanitarian” gnome icon theme available here.

EDIT:

There seems to be some problems with my extension right now (not printing or printing blank pages only) I’m working hard to figure it out, when I’ve got it I’ll update it here and if you have it installed it should automatically update your copy as well. I have reason to believe that it (and the two other print extensions that have since popped up) are broken because of this bug http://code.google.com/p/chromium/issues/detail?id=29621

Comments (5)

  1. December 29, 2009
    Michael said...

    Not sure about others, but it’s not working for me. It’ll bring up the printer dialog screen, but then won’t print. Would love for it to work, though; a very awesome, yet simple idea.

  2. December 29, 2009
    Jordan said...

    Hi Michael,
    The addon is actually currently broken. I think that this is because of a Chrome bug, I believe that at this time, I just need to wait for the bug to get squashed in Chrome.
    But thanks for dropping by!

  3. March 27, 2010
    Bill said...

    Hi, It would be nice if you stated at the top of the page rather than in the comments that it doesn’t work.

  4. March 28, 2010
    Jordan said...

    Hi Bill,
    Sorry about that, fixed it for you. I had previously stated that it was broken on the official extension page, but forgot to edit this page too.

  5. May 20, 2010
    JoelMMCC said...

    I’m very new to Chrome extension development, but I believe that the problem is not due to a Chrome bug (at least not anymore), but has to do with security restrictions in newer versions of Chrome that prevent extensions from directly referencing content.

    Right now, you have this in your “background.html”:
    chrome.browserAction.onClicked.addListener(function(tab) {
    window.print();
    });

    With the separation of extension and content, what you’re actually doing here is telling it to print “background.html,” regardless of the page actually in the tab! Well, “background.html” has no body (of course), and therefore nothing to print!

    What you need to do now is read up on injecting content script into the page, so that you execute “window.print();” from within the content script in the page itself, not the extension script.

Leave a Reply