Print Crystal Report

0
1
Hi Wisej,
How to print CrystalReport like that.
1. Link: https://www.aspsnippets.com/Articles/Print-Crystal-Report-on-Client-Side-on-Button-Click-using-JavaScript-in-ASPNet.aspx
2. Code:
<script type=”text/javascript”>
function Print() {
    var dvReport = document.getElementById(“dvReport”);
    var frame1 = dvReport.getElementsByTagName(“iframe”)[0];
    if (navigator.appName.indexOf(“Internet Explorer”) != -1) {
        frame1.name = frame1.id;
        window.frames[frame1.id].focus();
        window.frames[frame1.id].print();
    }
    else {
        var frameDoc = frame1.contentWindow ? frame1.contentWindow : frame1.contentDocument.document ? frame1.contentDocument.document : frame1.contentDocument;
        frameDoc.print();
    }
}
</script>
Thank you.
  • You must to post comments
0
0

Same way. button1_Click() { Application.Call(“print”); }

Assuming you have a javscript function print() and the ASP.NET Crystal Report viewer.

We usually use the PdfViewer instead since the pdf.js viewer is a lot better that the old ASP.NET viewer and the report rendering is a lot more accurate than HTML. You can view a crystal report with 2 lines of code.

  • Huỳnh Tấn Phát
    I see. But I can not get it. You can send demo using this script. Thank you so much.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.