Printing Report Programatically

3 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    87 posts
    Member since:
    Oct 2012

    Posted 27 Sep 2011 Link to this post

    Hi,

    I am trying to print my report programatically using a browser and it prints fine on my development machine but when I try to print the same report on a server my browser gets hanged. I tried on Internet Explorer 8, Firefox and on Google chrome but the problem still persists.

    Private Sub PrintReport(ByVal report As Telerik.Reporting.Report)
     
           Dim printerSettings As New System.Drawing.Printing.PrinterSettings
     
           ' The standard print controller comes with no UI
           Dim standardPrintController As New System.Drawing.Printing.StandardPrintController
     
           ' Print the report using the custom print controller
           Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor
           reportProcessor.PrintController = standardPrintController
           reportProcessor.PrintReport(report, printerSettings)
     
     
       End Sub
  2. Steve
    Admin
    Steve avatar
    10940 posts

    Posted 29 Sep 2011 Link to this post

    Hi Muhammad,

    Using server-side code for printing the report would end up printing the report on the server where the application is being run on and this is expected behavior. For web apps/sites where the print should happen on the client, you should use the client-side printing mechanism:

       <telerik:ReportViewer runat="server" id="ReportViewer1"></telerik:ReportViewer>                      
        <script type="text/javascript">
            <%=ReportViewer1.ClientID %>.PrintReport();
        </script>      

    Kind regards,
    Steve
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Muthuraj
    Muthuraj avatar
    5 posts
    Member since:
    Sep 2017

    Posted 06 Dec 2017 in reply to Steve Link to this post

    Hi Steve,

    I am facing an issue at the time of print report called, The issue is delayed to excecute PrintReport as it is taking approx 1.3 Mins which is huge time. Could you please have a look on below code and suggest the solution to achive faster way to print?

     public static bool Print(Telerik.Reporting.IReportDocument document, string printerName, short copies)
            {
                ReportProcessor processor = new ReportProcessor();

                System.Drawing.Printing.PrintController controller = new System.Drawing.Printing.StandardPrintController();

                processor.PrintController = controller;
                
                System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();

                printerSettings.PrinterName = printerName;
                printerSettings.Copies = copies;
                printerSettings.Collate = false;
    var repSource = (Telerik.Reporting.InstanceReportSource)document.Reports.FirstOrDefault();

    processor.PrintReport(repSource, printerSettings);
    return true;
            }

    Realy appreciate your inputs here and looking hear from you soon. Thanks!

    Regards!
    Muthu

Back to Top