jQuery Print Element Plugin

July 28, 2009

[UPDATE - Version released 1.0]

Similar to those “utilicous” moments are the “I got to write a jQuery plugin that does this” moments..

Had one of those a while ago, and the results were the jQuery Print Element Plugin.
For those of you that are not familiar with jQuery, I mentioned it previously in an early post.

So what does this plug-in do?

Well, as per the title, it sends a jQuery selected element to the printer.

So what’s special about it?

Well, I saw a few existing plug-ins around (Kudos again to PrintArea and this fellow for the inspiration), but they lacked the functionality I needed.

And of course, I really wanted to write my first jQuery plug-in :-)

The usage is rather strait forward:

$("selector").printElement();

  Which will caused the selected jQuery objects html to be sent to the printer.

There are two main modes you can use:

Print from :

  1. Iframe (default, Pro: Hidden)
  2. Popup (Pro: shows the user a preview of what’ll be printed)

For more info, and more options, have a look at the Wiki, or at the official plug-in page at jQuery.
Would love to hear any feedback, either here or at the issues section..

Cheers,

Erik

comments powered by Disqus