Printing Large Reports locks up the UI

Stimulsoft Reports.WPF discussion
hbdibit
Posts: 9
Joined: Sun Oct 02, 2016 11:38 pm

Printing Large Reports locks up the UI

Post 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
Attachments
StimulsoftLargeReport.7z
(3.16 MiB) Downloaded 368 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Printing Large Reports locks up the UI

Post 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.
hbdibit
Posts: 9
Joined: Sun Oct 02, 2016 11:38 pm

Re: Printing Large Reports locks up the UI

Post 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
Attachments
Attempting the print of a report<br />While the report is being sent to the printer spool, the report UI cannot be interacted with
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 5360 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Printing Large Reports locks up the UI

Post 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.
jcfarsight
Posts: 9
Joined: Tue Jul 24, 2018 3:18 am

Re: Printing Large Reports locks up the UI

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Printing Large Reports locks up the UI

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Printing Large Reports locks up the UI

Post 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.
jcfarsight
Posts: 9
Joined: Tue Jul 24, 2018 3:18 am

Re: Printing Large Reports locks up the UI

Post by jcfarsight »

Thank you very much for the quick turnaround. Will that new feature be added in the next release?
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Printing Large Reports locks up the UI

Post by Lech Kulikowski »

Hello,

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

Thank you.
jcfarsight
Posts: 9
Joined: Tue Jul 24, 2018 3:18 am

Re: Printing Large Reports locks up the UI

Post 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?
Post Reply