Multithreading

Hello there,

we want to process some document generation requests in a parallel manner, using more than one thread to generate pdf files via FastReport. I did not find many facts to that, neither in this forum nor in the documentation.

Basically, i call this method inside my started Task instances:
      public void GenerateDocument(Stream targetStream, FastReportEngineConfiguration configuration, DataSet dataset)
      {         
         using (var report = new Report())
         {
            report.Load(configuration.ReportTemplatePath);
            report.RegisterData(dataset);
            report.Prepare();
            using (var export = new PDFExport())
            {               
               report.Export(export, targetStream);
            }  
         }
      }

At first, i got some Nullpointer exceptions in my tests (basically 10 threads running that code) deep down inside the FastReport methods.
I found out that you have to turn ShowProgress / ShowPerformance to False.
         Config.ReportSettings.ShowProgress = false;
         Config.ReportSettings.ShowPerformance = false;

It seems to work with that, but i would like to be sure. Do I also have to do something else, or is this really all if trying to use FastReports with multiple threads? Are there any other caveats that should be mentioned?

Thanks in advance for any hints. [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Best regards Udontknow[/img]

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.