Page 1 of 2

Printing Large Reports locks up the UI

Posted: Thu Jan 19, 2017 11:10 pm
by hbdibit
Hello,

I have noticed when printing a report the UI become unresponsive until the report has been fully loaded into the printing queue. This is not a problem for small reports (as it happens very quickly), the larger the report gets the more obvious it becomes (to the point where windows believes my program has crashed due it its unresponsiveness)

Attached is an example of a 250 page report. Run the application and attempt to print the report, while the report is being sent to the printing queue none of the UI will work. It feels like the task to send the report to the queue needs to be run on a background thread?

Thanks
Craig

Re: Printing Large Reports locks up the UI

Posted: Sat Jan 21, 2017 11:50 am
by Alex K.
Hello,

Please check following samples:
https://www.stimulsoft.com/en/samples/w ... the-thread
https://www.stimulsoft.com/en/samples/w ... the-thread

These examples shows how to render a report in the thread. Rendering the report in the thread is run in the background process.

Thank you.

Re: Printing Large Reports locks up the UI

Posted: Wed Jan 25, 2017 2:49 am
by hbdibit
Hi Aleksey,

this is a solution for rendering the report.
I am talking printing of the report.

Doing these examples will render the report on a background thread but the UI will still lock up when attempting to print the report

Thank you

Re: Printing Large Reports locks up the UI

Posted: Wed Jan 25, 2017 2:49 pm
by HighAley
Hello.

The printing is processing in the same thread.
If you need to avoid the frozen UI, you could handle the Print event and use the solution above.
You could print the report from the other thread.

Thank you.

Re: Printing Large Reports locks up the UI

Posted: Tue Jul 24, 2018 3:28 am
by jcfarsight
Apologies about dredging up an old thread, I'm just working on this issue at the moment however and don't feel this issue was ever completely resolved.

Handling the Printing or Printed events on StiReport would allow us to be notified whenever the print process starts or ends but I don't see how it could be used to put the print task on a background thread if it was initiated from the report viewer.
I've had a quick look at the StiReport code but I can't see any hook points where an async or background task could be injected to force the print job off the UI thread.
Please note that I'm specifically talking about printing by using the print button on the report viewer and not starting the print process programmatically which can easily be put on a background thread.

Is there any chance someone could please point me in the right direction here?

Re: Printing Large Reports locks up the UI

Posted: Thu Jul 26, 2018 10:13 pm
by HighAley
Hello,

Sorry for taking so long to answer.
You are right, it's impossible to push the printing to another thread.
We are looking for a solution for you.
We will let you know when we get any result.

Thank you.

Ticket reference: #6698.

Re: Printing Large Reports locks up the UI

Posted: Mon Aug 06, 2018 9:41 am
by HighAley
Hello,

We have added next static option:

Code: Select all

StiOptions.Wpf.PrintInAnotherThread = true;
You should set it to True and the Viewer will be more responsive.

Thank you.

Re: Printing Large Reports locks up the UI

Posted: Sun Aug 12, 2018 10:13 pm
by jcfarsight
Thank you very much for the quick turnaround. Will that new feature be added in the next release?

Re: Printing Large Reports locks up the UI

Posted: Mon Aug 13, 2018 1:11 pm
by Lech Kulikowski
Hello,

Yes, that option will be available in the next release.

Thank you.

Re: Printing Large Reports locks up the UI

Posted: Mon Nov 12, 2018 9:50 pm
by jcfarsight
Greetings,
We've upgraded to 2018.3.4 and have set the new StiOptions.Wpf.PrintInAnotherThread value to true. Testing the change by printing a 200 page report shows that the UI is still locked up.
Having a quick look at the code shows that you're using a BackgroundWorker which calls off to the print provider which is fine, but then the provider invokes the work back onto the dispatcher thread which then locks up the UI and makes the BackgroundWorker redundant.

Were you able to successfully print a large report in the background?