jQuery Plugin - jPrintArea

September 17th, 2007

What is jPrintArea?

jPrintArea is a small jquery plugin to print only contents of a specified element. P.S. This is my first jQuery Plugin

Demo And Download here

17 Responses to “jQuery Plugin - jPrintArea”

  1. VitaL Says:

    Hello. please can iyou indicate me like to insert this javascript to the code of the portal, since I have to do the link so that it prints? thank you

  2. Air_Mike Says:

    Hey,

    this small plugin is great, and just what I was looking for, but there is one problem. It works great on FF, but fail printing on IE. Iframe does get created and is filled with content, but when it comes to printing, it does not print its content. I tried to fix this but failed. Could you please look at it… Thank you…

  3. kamal Says:

    mike, its working fine with ie7 in my laptop. i think you should be using ie6. Anyway, i’ll check and update the script. thanks for leaving your feedback.

  4. ilhank Says:

    Great tool. Thanks but its not working on ie7.
    (My browser version: 7.0.5730.13)
    But working on firefox. If you cna fix it, it will be great.

  5. aupong Says:

    It’s a great plugin.
    But, Is it possible to keep the layout as seen on the browser? Now the printed output has no format. E.g. The border of the table.
    Looking forward to your reply. Thank you.

  6. Xit Says:

    Yes, on IE7, the script print all the page.

  7. Will Says:

    How can I get rid of the alert box. I tried removing the scipt line (alert(’Printing…’);) but by doing so it stoped working in FireFox and IE6

    Thanks,

    Will

  8. Alex Says:

    Hey, its not working for me with firefox.. but works very well with ie7…
    Why?
    FF doesn’t give any error, its just that when i click nothing happens. It works with IE7.

    I just print an image area.

  9. Alex Says:

    I got it working with firefox and explorer :)
    The problem was that if you remove that line (alert(printing)) it stops working.

    Just add this instead of that line:
    wait(1);

  10. Anghram Says:

    Great script, thanks. Caught some bugs. One of them is - when you’re trying to print a page with several css included, it prints the whole page, not the chosen area. That’s sad, cuz anyway - css do not work here.
    Anyway, thanks for the idea!

  11. kamal Says:

    Alex -> you were right will do the changes… i forgot the wait() function… i had to delay the process there thats y i used alert…

  12. Anghram Says:

    Doesn’t work in Opera.

  13. Yoosuf Says:

    hey,

    im facing a issue in jprint plugin. mainly after clicking the print link a javascript error is occuring as “Object expected”.

    is there any solution to fix that issue?

    Yoosuf
    http://yoosuf.awardspace.com/

  14. xxmenioxx Says:

    heey !
    Ur plug in it’s so good, but i made some change’s on it, because the WAIT() it doesn’t a funcion so, u may have 1 error on Internet Explorer and Mozilla, so this is just what u have to do:

    jQuery.jPrintArea=function(el)
    {
    // First i change the alert for a hidden div with an preloader.
    var loader = $j(’printing…‘)
    .appendTo(”#message”);
    loader.hide();
    loader.fadeIn(’slow’);

    var iframe=document.createElement(’IFRAME’);
    var doc=null;
    $j(iframe).attr(’style’,'position:absolute;width:0px;height:0px;left:-500px;top:-500px;’);
    document.body.appendChild(iframe);
    doc=iframe.contentWindow.document;
    var links=window.document.getElementsByTagName(’link’);
    for(var i=0;i’);
    // then i made a special CSS for my printing. (this is only for a better view).
    doc.write(”+$j(el).html()+”);
    doc.close();
    iframe.contentWindow.focus();
    iframe.contentWindow.print();
    //Add some Fx’s to make it COOL JEJEJE.
    loader.animate({opacity: 1.0}, 6000)
    loader.fadeOut(’slow’, function() {
    $(this).remove();
    });
    //Finally this is the best part, with setTimeout u prevent the error message on explorer and mozilla.
    setTimeout(”document.body.removeChild(iframe)”,5000);

    }

    :) !

  15. xxmenioxx Says:

    ammmm …

    jQuery.jPrintArea=function(el)
    {
    // First i change the alert for a hidden div with an preloader.
    var loader = $j(’printing‘)

    .appendTo(”#message”);
    loader.hide();
    loader.fadeIn(’slow’);

  16. xxmenioxx Says:

    OMG !
    asdfasdfghdg
    ghj
    f

    var loader = $j(’Wait‘)

  17. xxmenioxx Says:

    ok

    printing

    inside the :
    var loader = $j()

Leave a Reply