SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a requirement to print the page without print dialog.

We have tried the following JavaScript:

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(7,2); // Error: Object doesn't suport this property or method

    return false;

The above code is working in normal ASP.NET application. But its not working in a Sharepoint Page and giving the error metioned above

share|improve this question
up vote 3 down vote accepted

The easiest, non intrusive approach i usually recommend for printing, is having a dedicated CSS for this purpose that would hide unwanted navigation and other controls.

Add a new CSS link with media="print" and the browser will take care of the rest.

<link rel="stylesheet" type="text/css" href="/_layouts/1033/styles/print.css" media="print" />
share|improve this answer

That does not depend on Sharepoint, but on HTML, Browsers and Security. I assume you are searching for an solution for IE-Browsers only? I would expect that it should be possible with ActiveX, .NET, Silverlight somehow.

Perhaps, if you know which printer is it, you could send an AJAX Request to your server which prints than that page.

But IMHO it is a very uncommon task and you should be carefull with just printing a page. So there is no chance to print to pdf, email etc. I think it is not a good thing, to hide the print dialog.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.