Click here to Skip to main content
Click here to Skip to main content
Go to top

Report Viewer Print Problem in Chrome, Mozilla Browsers

, 10 Jul 2012
Rate this:
Please Sign up or sign in to vote.
Report Viewer print issue in Chrome / Mozilla / Safari: A solution where you can print report contents inside Report Viewer in any browser.

Sample Image

Introduction

Report Viewer print issue in Chrome / Mozilla / Safari browser solved.

Background

In the case of Chrome or Mozilla or in Safari, we can not get print option for Report Viewer to print the report content inside the viewer. Everyone tries a custom control or ActiveX control to get the print option enabled for the Report Viewer. Instead of that we can simply add a jQuery function for getting the contents of a report to print directly.

Using the code

Given below is code to get print facility for Report Viewer in a very simple manner:

//call printdiv() function on button click
<input name="b_print" type="button" onclick="printdiv();" value=" Print Report" />
//function for print
function printdiv() {
   //Code for adding HTML content to report viwer
    var headstr = "<html><head><title></title></head><body>";
    //End of body tag
    var footstr = "</body></html>";
    //This the main content to get the all the html content inside the report viewer control
    //"ReportViewer1_ctl10" is the main div inside the report viewer
    //controls who helds all the tables and divs where our report contents or data is available
    var newstr = $("#ReportViewer1_ctl10").html();
    //open blank html for printing
    var popupWin = window.open('', '_blank');
    //paste data of printing in blank html page
    popupWin.document.write(headstr + newstr + footstr);
    //print the page and see is what you see is what you get
    popupWin.print(); 
    return false;
}

Language used is C# done in ASP.NET 4.0 using jQuery and JavaScript.

Points of Interest

You can use Report Viewer version 8.0/9.0/10.0. The thing you have to do is always find the ID of your div inside Report Viewer. If you get the ID, you can directly use it else if div is inside an iFrame then find the iFrame first and then the div where your report data resides.

If your report appears inside IFrame, then go though this code. The main thing for this code is tracking your div which contains the data.

//call printdiv() function on button click
<input name="b_print" type="button" onclick="printdiv();" value=" Print Report" />
//function for print
    function printdiv() {
        //Code for adding HTML content to report viwer
        var headstr = "<html><head><style>.a86{border:1pt None Black;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left:2pt;" + 
           "padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;" + 
           "font-family:Arial;font-size:10pt;font-weight:Normal;text-decoration:None;" + 
           "direction:LTR;unicode-bidi:Normal;text-align:left;writing-mode:lr-tb;" + 
           "vertical-align:Top;color:Black;}.a5_s{WIDTH:146.05mm;HEIGHT:6.35mm;" + 
           "font-style:Normal;font-family:Arial;font-size:10pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Center;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;}.a5{border:1pt None Black;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left:0pt;" + 
           "padding-top:0pt;padding-right:0pt;padding-bottom:0pt;HEIGHT:6.35mm;" + 
           "overflow:hidden;WIDTH:146.05mm}.a92{border:1pt None Black;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left:0pt;" + 
           "padding-top:0pt;padding-right:0pt;padding-bottom:0pt;WIDTH:114.30mm}.a96{" + 
           "border:1pt None Black;background-color:Transparent;background-repeat:" + 
           "Repeat;padding-left:0pt;padding-top:0pt;padding-right:0pt;padding-bottom:0pt;" + 
           "WIDTH:114.30mm}.a98{border:1pt None Black;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:0pt;padding-top:0pt;padding-right:0pt;" + 
           "padding-bottom:0pt;WIDTH:38.10mm;HEIGHT:19.05mm;overflow:hidden}.a99" + 
           "{border:1pt None Black;background-color:Transparent;background-repeat:" + 
           "Repeat;padding-left:0pt;padding-top:0pt;padding-right:0pt;padding-bottom:0pt;" + 
           "font-style:Normal;font-family:Arial;font-size:12pt;font-weight:700;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;}.a100{border:1pt None Black;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left:0pt;padding-top:" + 
           "0pt;padding-right:0pt;padding-bottom:0pt;font-style:Normal;font-family:Arial;" + 
           "font-size:10pt;font-weight:Normal;text-decoration:None;direction:LTR;unicode-bidi:" + 
           "Normal;text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:Black;}." + 
           "a101{border:1pt None Black;background-color:Transparent;background-repeat:Repeat;" + 
           "padding-left:0pt;padding-top:0pt;padding-right:0pt;padding-bottom:0pt;" + 
           "font-style:Normal;font-family:Arial;font-size:10pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;}.a102{border:1pt None Black;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left:0pt;" + 
           "padding-top:0pt;padding-right:0pt;padding-bottom:0pt;font-style:Normal;" + 
           "font-family:Arial;font-size:10pt;font-weight:Normal;text-decoration:None;" + 
           "direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;" + 
           "vertical-align:Top;color:Black;}.a103{border:1pt None Black;background-color" + 
           ":Transparent;background-repeat:Repeat;padding-left:0pt;padding-top:0pt;" + 
           "padding-right:0pt;padding-bottom:0pt;font-style:Normal;font-family:Arial;" + 
           "font-size:10pt;font-weight:Normal;text-decoration:None;direction:LTR;" + 
           "unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:Black;}" + 
           ".a85{border:1pt None Black;background-color:Transparent;background-repeat:Repeat;" + 
           "padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;" + 
           "font-family:Arial;font-size:11pt;font-weight:700;text-decoration:None;direction:LTR;" + 
           "unicode-bidi:Normal;text-align:Center;writing-mode:lr-tb;vertical-align:Top;color:Black;" + 
           "}.a6{border:1pt None Black;background-color:Transparent;background-repeat:Repeat;" + 
           "padding-left:0pt;padding-top:0pt;padding-right:0pt;padding-bottom:0pt;border" + 
           "-collapse:collapse}.a76{border:1pt None Black;border-top-style:Solid;border" + 
           "-bottom-style:Solid;background-color:Transparent;background-repeat:Repeat;" + 
           "padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font" + 
           "-style:Normal;font-family:Arial;font-size:9pt;font-weight:700;text-decoration" + 
           ":None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;" + 
           "vertical-align:Top;color:Black;word-wrap:break-word}.a77{border:1pt None " + 
           "Black;border-top-style:Solid;border-bottom-style:Solid;background-color:" + 
           "Transparent;background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding" + 
           "-right:2pt;padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:" + 
           "9pt;font-weight:700;text-decoration:None;direction:LTR;unicode-bidi:Normal;" + 
           "text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap" + 
           ":break-word}.a78{border:1pt None Black;border-top-style:Solid;border-bottom" + 
           "-style:Solid;background-color:Transparent;background-repeat:Repeat;padding" + 
           "-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style" + 
           ":Normal;font-family:Arial;font-size:9pt;font-weight:700;text-decoration" + 
           ":None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode" + 
           ":lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a79{border" + 
           ":1pt None Black;border-top-style:Solid;border-bottom-style:Solid;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left" + 
           ":2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style" + 
           ":Normal;font-family:Arial;font-size:9pt;font-weight:700;text-decoration" + 
           ":None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode" + 
           ":lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a80{border" + 
           ":1pt None Black;border-top-style:Solid;border-bottom-style:Solid;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left" + 
           ":2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style" + 
           ":Normal;font-family:Arial;font-size:9pt;font-weight:700;text-decoration" + 
           ":None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode" + 
           ":lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a81{border" + 
           ":1pt None Black;border-top-style:Solid;border-bottom-style:Solid;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left" + 
           ":2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style" + 
           ":Normal;font-family:Arial;font-size:9pt;font-weight:700;text-decoration" + 
           ":None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode" + 
           ":lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a82{border" + 
           ":1pt None Black;border-top-style:Solid;border-bottom-style:Solid;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left" + 
           ":2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style" + 
           ":Normal;font-family:Arial;font-size:9pt;font-weight:700;text-decoration" + 
           ":None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode" + 
           ":lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a83{border" + 
           ":1pt None Black;border-top-style:Solid;border-bottom-style:Solid;background" + 
           "-color:Transparent;background-repeat:Repeat;padding-left:2pt;padding-top:2pt;" + 
           "padding-right:2pt;padding-bottom:2pt;font-style:Normal;font-family:Arial;font-" + 
           "size:9pt;font-weight:700;text-decoration:None;direction:LTR;unicode-bidi:Normal;" + 
           "text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:" + 
           "break-word}.a84{border:1pt None Black;border-top-style:Solid;border-bottom-" + 
           "style:Solid;background-color:Transparent;background-repeat:Repeat;padding-left" + 
           ":2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;font" + 
           "-family:Arial;font-size:9pt;font-weight:700;text-decoration:None;direction:LTR;" + 
           "unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:" + 
           "Black;word-wrap:break-word}.a17{border:1pt None Black;border-top-style:" + 
           "Solid;border-bottom-style:Solid;background-color:Transparent;background-repeat" + 
           ":Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;" + 
           "font-style:Normal;font-family:Arial;font-size:10pt;font-weight:700;text-decoration:" + 
           "None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;vertical-align:" + 
           "Top;color:Black;word-wrap:break-word}.a18{border:1pt None Black;border-" + 
           "top-style:Solid;border-bottom-style:Solid;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;" + 
           "padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:10pt;font-weight:" + 
           "Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a19" + 
           "{border:1pt None Black;border-top-style:Solid;border-bottom-style:Solid;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left:2pt;" + 
           "padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;" + 
           "font-family:Arial;font-size:10pt;font-weight:Normal;text-decoration:None;" + 
           "direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;" + 
           "vertical-align:Top;color:Black;word-wrap:break-word}.a20{border:1pt None Black;border" + 
           "-top-style:Solid;border-bottom-style:Solid;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;" + 
           "padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:10pt;" + 
           "font-weight:Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;" + 
           "text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap" + 
           ":break-word}.a21{border:1pt None Black;border-top-style:Solid;border-" + 
           "bottom-style:Solid;background-color:Transparent;background-repeat:Repeat;" + 
           "padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;" + 
           "font-style:Normal;font-family:Arial;font-size:10pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a22{border:" + 
           "1pt None Black;border-top-style:Solid;border-bottom-style:Solid;background-color" + 
           ":Transparent;background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding" + 
           "-right:2pt;padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:10pt;" + 
           "font-weight:Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;" + 
           "text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:" + 
           "break-word}.a23{border:1pt None Black;border-top-style:Solid;border-bottom" + 
           "-style:Solid;background-color:Transparent;background-repeat:Repeat;padding" + 
           "-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:" + 
           "Normal;font-family:Arial;font-size:10pt;font-weight:Normal;text-decoration" + 
           ":None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;" + 
           "vertical-align:Top;color:Black;word-wrap:break-word}.a35{border:1pt None Black;" + 
           "border-bottom-style:Solid;background-color:Transparent;background-" + 
           "repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-" + 
           "bottom:2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode" + 
           ":lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a36{border:1pt None Black;" + 
           "border-bottom-style:Solid;background-color:Transparent;background-repeat:Repeat;" + 
           "padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style" + 
           ":Normal;font-family:Arial;font-size:9pt;font-weight:Normal;text-decoration:None;" + 
           "direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;vertical-" + 
           "align:Top;color:Black;word-wrap:break-word}.a37{border:1pt None Black;border-" + 
           "bottom-style:Solid;background-color:Transparent;background-repeat:Repeat;padding" + 
           "-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;" + 
           "font-family:Arial;font-size:9pt;font-weight:Normal;text-decoration:None;direction:" + 
           "LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;vertical-align:Top;color" + 
           ":Black;word-wrap:break-word}.a38{border:1pt None Black;border-bottom-style:Solid" + 
           ";background-color:Transparent;background-repeat:Repeat;padding-left:2pt;padding-" + 
           "top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;font-family:Arial;" + 
           "font-size:9pt;font-weight:Normal;text-decoration:None;direction:LTR;unicode-bidi" + 
           ":Normal;text-align:Left;writing-mode:lr-tb;vertical-align:Top;color:Black;word-" + 
           "wrap:break-word}.a39{border:1pt None Black;border-bottom-style:Solid;background-" + 
           "color:Transparent;background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding" + 
           "-right:2pt;padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:9pt;" + 
           "font-weight:Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align" + 
           ":Left;writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}" + 
           ".a40{border:1pt None Black;border-bottom-style:Solid;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;" + 
           "padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight:" + 
           "Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a41{" + 
           "border:1pt None Black;border-bottom-style:Solid;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;" + 
           "padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight" + 
           ":Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a42" + 
           "{border:1pt None Black;border-bottom-style:Solid;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;" + 
           "padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight" + 
           ":Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a43" + 
           "{border:1pt None Black;border-bottom-style:Solid;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;" + 
           "padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight" + 
           ":Normal;text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left" + 
           ";writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}.a55{border" + 
           ":1pt None Black;border-bottom-style:None;background-color:Transparent;background" + 
           "-repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom" + 
           ":2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}" + 
           ".a56{border:1pt None Black;background-color:Transparent;background-repeat:" + 
           "Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:" + 
           "2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}." + 
           "a57{border:1pt None Black;background-color:Transparent;background-repeat:" + 
           "Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom:" + 
           "2pt;font-style:Normal;font-family:Arial;font-size:10pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}" + 
           ".a58{border:1pt None Black;background-color:Transparent;background-repeat" + 
           ":Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom" + 
           ":2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}" + 
           ".a59{border:1pt None Black;background-color:Transparent;background-repeat" + 
           ":Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;padding-bottom" + 
           ":2pt;font-style:Normal;font-family:Arial;font-size:9pt;font-weight:Normal;" + 
           "text-decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}." + 
           "a60{border:1pt None Black;border-bottom-style:None;background-color:" + 
           "Transparent;background-repeat:Repeat;padding-left:2pt;padding-top:2pt" + 
           ";padding-right:2pt;padding-bottom:2pt;font-style:Normal;font-family" + 
           ":Arial;font-size:10pt;font-weight:Normal;text-decoration:None;direction" + 
           ":LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;vertical" + 
           "-align:Top;color:Black;word-wrap:break-word}.a61{border:1pt None Black" + 
           ";background-color:Transparent;background-repeat:Repeat;padding-left" + 
           ":2pt;padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style" + 
           ":Normal;font-family:Arial;font-size:9pt;font-weight:Normal;text-" + 
           "decoration:None;direction:LTR;unicode-bidi:Normal;text-align:Left;" + 
           "writing-mode:lr-tb;vertical-align:Top;color:Black;word-wrap:break-word}" + 
           ".a62{border:1pt None Black;background-color:Transparent;background-" + 
           "repeat:Repeat;padding-left:2pt;padding-top:2pt;padding-right:2pt;" + 
           "padding-bottom:2pt;font-style:Normal;font-family:Arial;font-size:" + 
           "10pt;font-weight:Normal;text-decoration:None;direction:LTR;unicode" + 
           "-bidi:Normal;text-align:Left;writing-mode:lr-tb;vertical-align:Top;" + 
           "color:Black;word-wrap:break-word}.a63{border:1pt None Black;background" + 
           "-color:Transparent;background-repeat:Repeat;padding-left:2pt;padding-" + 
           "top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;font-" + 
           "family:Arial;font-size:9pt;font-weight:Normal;text-decoration:None;" + 
           "direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;" + 
           "vertical-align:Top;color:Black;word-wrap:break-word}.a87{border:1pt " + 
           "None Black;border-top-style:Dotted;background-color:Transparent;" + 
           "background-repeat:Repeat;padding-left:0pt;padding-top:0pt;padding-" + 
           "right:0pt;padding-bottom:0pt;WIDTH:100%}.a90{border:1pt None Black;" + 
           "background-color:Transparent;background-repeat:Repeat;padding-left:2pt;" + 
           "padding-top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;" + 
           "font-family:Arial;font-size:9pt;font-weight:Normal;text-decoration:None;" + 
           "direction:LTR;unicode-bidi:Normal;text-align:Left;writing-mode:lr-tb;" + 
           "vertical-align:Top;color:Black;}.a89{border:1pt None Black;background-" + 
           "color:Transparent;background-repeat:Repeat;padding-left:2pt;padding-" + 
           "top:2pt;padding-right:2pt;padding-bottom:2pt;font-style:Normal;font-" + 
           "family:Arial;font-size:9pt;font-weight:Normal;text-decoration:None;" + 
           "direction:LTR;unicode-bidi:Normal;text-align:Right;writing-mode:lr-" + 
           "tb;vertical-align:Top;color:Black;}.r1{HEIGHT:100%;WIDTH:100%}." + 
           "r2{HEIGHT:100%;WIDTH:100%;overflow:hidden}.r3{HEIGHT:100%}.r4{" + 
           "border-style:none}.r5{border-left-style:none}.r6{border-right-" + 
           "style:none}.r7{border-top-style:none}.r8{border-bottom-style:none}." + 
           "r10{border-collapse:collapse}.r9{border-collapse:collapse;table-layout" + 
           ":fixed}.r11{WIDTH:100%;overflow-x:hidden}.r12{position:absolute;display" + 
           ":none;background-color:white;border:1px solid black;}.r13{text-decoration:" + 
           "none;color:black;cursor:pointer;}</style><title></title></head><body>";
        //End of body tag
        var footstr = "</body></html>";
        //ReportFramecntPlcHolder_ReportViewer1 is the id of Iframe where yor report content div resides
        $("#ReportFramecntPlcHolder_ReportViewer1").each(function () {
            //report is the id of frameset where yor report content div resides
            $("#report", this.contentWindow.document || this.contentDocument).each(function () {
                //oReportDiv is the id of div where yor report content resides
                var newstr = $("#oReportDiv", this.contentWindow.document || this.contentDocument).html();
                //document.body.innerHTML = headstr + newstr + footstr;
                //window.print();
                //open blank html for printing
                var popupWin = window.open('', '_blank');
                //paste data of printing in blank html page
                popupWin.document.write(headstr + newstr + footstr);
                //print the page and see is what you see is what you get
                popupWin.print(); 
            });

        });
        return false;
    }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

anirudha-kulkarni01
Software Developer (Senior)
India India
No Biography provided

Comments and Discussions

 
QuestionThanks..it's works.. PinmemberKinjal Sucess7-Mar-14 0:32 
GeneralMy vote of 1 PinmemberCarlo Ingrassia6-Nov-13 2:29 
QuestionReport data not view Pinmemberbreaker-code2-Jul-13 22:41 
QuestionReport data not view Pinmemberbreaker-code2-Jul-13 22:40 
GeneralMy vote of 4 PinmemberSarvesh Kushwaha19-Nov-12 1:04 
GeneralMy vote of 3 Pinmemberitzwiki16-Nov-12 19:41 
cant print more than 2 pages.. well nice try though
QuestionDoes it print 'all' pages from the report? PinmemberEricGeerts8-Nov-12 3:20 
AnswerRe: Does it print 'all' pages from the report? Pinmemberitzwiki16-Nov-12 19:42 
AnswerRe: Does it print 'all' pages from the report? PinmemberSajithDilhan8-Oct-13 22:54 
GeneralRe: Does it print 'all' pages from the report? PinmemberGaryParkin23-Jun-14 9:04 
QuestionProblem PinmemberMember 36593674-Nov-12 22:50 
QuestionPRINT BUTTON IN SSRS IN CHROME PinmemberMember 365936731-Oct-12 22:19 
GeneralMy vote of 5 PinmemberNilesh Patil Kolhapur12-Jul-12 20:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140921.1 | Last Updated 10 Jul 2012
Article Copyright 2012 by anirudha-kulkarni01
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid