print preview area using simple jquery.
no need any extra api or script .
just use below code to print form or DIV part
$('#printA').click(function(){
var content = document.getElementById('printcontent').innerHTML;
var mywindow = window.open('', 'Print', 'height=600,width=800');
mywindow.document.write('<html><head><title>Print Content</title>');
mywindow.document.write('</head><body >');
mywindow.document.write(content);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.focus();
mywindow.print();
mywindow.close();
return true;
});
to use above code do simple steps.
1. ensure jquery.min.js is use or simple use above to javascript
2. print button
3. onclick of this button above code will paste
4. simplly open print window
5. suppose after filling form or displaying data print function is needed then use above print function