Printing Large Reports locks up the UI
Printing Large Reports locks up the UI
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
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
- Attachments
-
- StimulsoftLargeReport.7z
- (3.16 MiB) Downloaded 379 times
Re: Printing Large Reports locks up the UI
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.
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
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
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
- Attachments
-
- Attempting the print of a report
While the report is being sent to the printer spool, the report UI cannot be interacted with - printLock.png (44.97 KiB) Viewed 5459 times
- Attempting the print of a report
Re: Printing Large Reports locks up the UI
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.
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.
-
- Posts: 9
- Joined: Tue Jul 24, 2018 3:18 am
Re: Printing Large Reports locks up the UI
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?
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
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.
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
Hello,
We have added next static option:
You should set it to True and the Viewer will be more responsive.
Thank you.
We have added next static option:
Code: Select all
StiOptions.Wpf.PrintInAnotherThread = true;
Thank you.
-
- Posts: 9
- Joined: Tue Jul 24, 2018 3:18 am
Re: Printing Large Reports locks up the UI
Thank you very much for the quick turnaround. Will that new feature be added in the next release?
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Printing Large Reports locks up the UI
Hello,
Yes, that option will be available in the next release.
Thank you.
Yes, that option will be available in the next release.
Thank you.
-
- Posts: 9
- Joined: Tue Jul 24, 2018 3:18 am
Re: Printing Large Reports locks up the UI
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?
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?