Saturday, 14 September 2013

jQuery , printer access ( print area inside a #div )

In order to open the printing dialog into the same page you must follow the following steps:


  • Must include jquery script inside header
  • Create Iframe inside your html body , like this :                                                                                 <iframe id="iframe" width="0" height="0"></iframe>
  • User following lines on click event of any element ( lets say button ): $('iframe').contents().find('body').html($(this).html());                                         window.frames['iframe'].print();


And that's just all.

No comments:

Post a Comment