How can I get the view from the controller? I am trying to convert the page to an image and using the webclientPrint
to send the image to a thermal printer.
I can not use window.print();
because the thermal printer may not accept the data and I also don't want to show the printer dialog to the user also.
Review
I want to capture whole web page and convert it to an image.
function Printlabel() {
debugger
if (navigator.appName == "Microsoft Internet Explorer") {
var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = "";
}
else {
var contents = document.getElementById("PrintArea").innerHTML;
var frame1 = document.createElement('iframe');
frame1.name = "frame1";
frame1.style.position = "absolute";
frame1.style.top = "-1000000px";
document.body.appendChild(frame1);
var frameDoc = frame1.contentWindow ? frame1.contentWindow : frame1.contentDocument.document ? frame1.contentDocument.document : frame1.contentDocument;
frameDoc.document.open();
frameDoc.document.write('<html><head><title></title>');
frameDoc.document.write('<link rel="stylesheet" type="text/css" href="/Styles/labelStyle.css" media="print">');
frameDoc.document.write('</head><body>');
frameDoc.document.write(contents);
frameDoc.document.write('</body></html>');
frameDoc.document.close();
setTimeout(function () {
window.frames["frame1"].focus();
window.frames["frame1"].print();
document.body.removeChild(frame1);
}, 500);
}
setTimeout("window.open('', '_self', ''); window.close();", 5000);
return false;
}