This is a migrated thread and some comments may be shown as answers.

Printing Report Programatically

2 Answers 265 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Muhammad
Top achievements
Rank 1
Muhammad asked on 27 Sep 2011, 05:00 PM
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 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 29 Sep 2011, 01:35 PM
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 >>

0
Muthuraj
Top achievements
Rank 2
answered on 06 Dec 2017, 04:02 PM

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

Tags
General Discussions
Asked by
Muhammad
Top achievements
Rank 1
Answers by
Steve
Telerik team
Muthuraj
Top achievements
Rank 2
Share this question
or