Jquery plugin to Print specific div with applied CSS
Sometime we need to print website, but do not want its header footer sidebar and other things, in short we need to print a specific div or p or table or some other object.
This plugin will allow you to print specific html object along will all css applied on it.
its simple to use.
- include jquery library
- include print-preview.js plugin
- initiate plugin and provide target html object to print
you can specify many other options like want to send additional css to be applied, width/height and more
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<script type="text/javascript"> $(function(){ $("#btnPrint").printPreview({ obj2print:'#masterContent', width:'810' /*optional properties with default values*/ //obj2print:'body', /*if not provided full page will be printed*/ //style:'', /*if you want to override or add more css assign here e.g: "<style>#masterContent:background:red;</style>"*/ //width: '670', /*if width is not provided it will be 670 (default print paper width)*/ //height:screen.height, /*if not provided its height will be equal to screen height*/ //top:0, /*if not provided its top position will be zero*/ //left:'center', /*if not provided it will be at center, you can provide any number e.g. 300,120,200*/ //resizable : 'yes', /*yes or no default is yes, * do not work in some browsers*/ //scrollbars:'yes', /*yes or no default is yes, * do not work in some browsers*/ //status:'no', /*yes or no default is yes, * do not work in some browsers*/ //title:'Print Preview' /*title of print preview popup window*/ }); }); </script> |





Visit Today : 14
Total Visit : 933900
Total Hits : 3547727043
Comments