Yes! I am sure the same code can be use to print document located at the server.
What you have to do is to put one IFRAME (that should be invisible) in the page. and set the src of that IFRAME to the document url which is located at the server.
IFRAME can be make invisible by setting its HEIGHT and WIDTH to 0.
<iframe id="fraDocument" style="WIDTH: 0px; HEIGHT: 0px" src="document1.htm"></iframe>
Now
Modify the previous javascript code as
function PrintIt()
{
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>;';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, -1);
WebBrowser1.outerHTML = fraDocument.innerHTML;
}
</script>
Though I didnt test above "hypothesis" :) . But I am sure that above approach will work.
Please let me know if you have succeed in printing server docuement without "displaying" it on the browser.
Regards