Reporting from Win Forms

2 posts, 0 answers
  1. Роберт
    Роберт avatar
    61 posts
    Member since:
    Feb 2010

    Posted 10 Dec 2014 Link to this post

    Hi, here is the simple code:

            
    void ReportToDefault(Report report)
            {
                if (report == null) return;
     
                System.Drawing.Printing.PrintController standardPrintController =
                                        new System.Drawing.Printing.StandardPrintController();
                Telerik.Reporting.Processing.ReportProcessor reportProcessor
                                                    = new Telerik.Reporting.Processing.ReportProcessor();
                reportProcessor.PrintController = standardPrintController;
                try
                {
                    reportProcessor.PrintReport(report, Properties.Settings.Default.defaultPrinter);
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }
            }

    What is the best practice: to create the report processor and controller each time a doc is printed in background (for instance if it's kinda printing manager, and it receives requests to print from different apps), or better to instantiate the both classes once on the app start up and then just call Print Report?
    Is it ok if several Print controllers and processors are active and several threads?
    The idea is simple.. if we have the intensive doc-to-print feedback, then what's the better way to be sure the general App is not hanging on while printing is not over?

    Thank you!
  2. KS
    KS avatar
    165 posts
    Member since:
    Oct 2012

    Posted 13 Dec 2014 in reply to Роберт Link to this post

    Hi,

    Sounds like threading question and I suppose it is better to have a new report object for each print operation... Or print at the client, and avoid the server overload - Print a report directly at client-side without displaying it in an ASP.NET ReportViewer

    -KS
Back to Top