I am working on an asp.net project. in my current page, I need to print an image, I used jquery to print this, my code is below.
function VoucherSourcetoPrint(source) {
var width = $("#imgWidth").val();
var height = $("#imgHeight").val();
return "<html><head><script>function step1(){\n" +
"setTimeout('step2()', 10);}\n" +
"function step2(){window.print();window.close()}" +
"\n<\/script></head><body onload='step1()'>\n" +
"<img src='" + source + "' style='width: " + width + "px; height: " + height + "px;' /></body></html>";
}
function VoucherPrint(source) {
source = $('#imgCtrl').attr('src');
Pagelink = "about:blank";
var pwa = window.open(Pagelink, "_new");
pwa.document.open();
pwa.document.write(VoucherSourcetoPrint(source));
pwa.document.close();
}
As you can see the height and width are taken from textboxes. after calling VoucherPrint function it shows print dialogue as below,
So I am trying to achieve some things,
- Remove header and footer using code
- increase no of print, ie no of images per page using code?
is there any way to achieve these? through jquery or CSS?