We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Out of memory error when trying to print a report more than 9 pages with print dpi set to 300

Thread ID:

Created:

Updated:

Platform:

Replies:

149750 Dec 7,2019 12:06 PM UTC Jan 12,2020 05:24 PM UTC WPF 22
loading
Tags: ReportViewer
Ahmed
Asked On December 7, 2019 01:12 PM UTC

Hello everyone,

setting reportviewer.PrintDpiX = 300 & reportviewer.PrintDpiY = 300 not only doesn't provide optimal print quality but also causes an out of memory exception after 9 pages..

To get a good printing resolution, i have to set the dpi to 600, but then the report can't print more than 2 pages without throwing an out of memory exception..

If I reduce the dpi, more pages are printed but low quality, and also the exception is thrown by exceeding a certain number of pages...

I made the following trials with different Dpi's..

DpiPrint QualityMaximum number of pages before Out-Of-Memory error
96 (default)very bad105
300acceptable but not optimal9
600good2

Would you please make it possible to print in high quality (600 dpi) and a lot of pages (some reports produce 100+ pages)..



Vinoth Srinivasan [Syncfusion]
Replied On December 9, 2019 09:15 AM UTC

Hi Ahmed, 

When you set the PrintDpi value to improve the print quality, the size for processing the report will get increased. Due to this you are facing the out of memory exception. Could you please confirm whether your requirement is to render the report in PDF format? if yes, then you can export the report in PDF format for your requirement. Based on your confirmation we can proceed further on this. 

Regards, 
Vinoth S. 


Ahmed
Replied On December 10, 2019 04:25 AM UTC

I understand the reason behind the exception, but I believe it's still a bug that needs to be fixed, because even if you didn't alter the Dpi and sacrificed the quality, you only get to print 105 pages and the exception is still thrown..

My requirement is to allow users of my application to directly print the report in good quality....

Compared to MS Report Viewer, Syncfusion's Report Viewer has many good qualities, but regarding the most important feature of the report (printability in good quality) MS report viewer is way better, I just printed a 200+ pages report from there in perfect quality without any issue.. 

I am saying this just to clarify that it's possible to print both in high quality and a high number of pages.. 

Of course there is a work around (to ask the users to first export the report to excel (as exporting to PDF renders Arabic wrong) then printing that excel file) but that's a bad user experience..

On a side note, the print dialog is very much out of place, imagine your self using a very beautiful control, then you click print and you teleport back to windows 98 interface :) It would be very nice if the printing interface was as visually appealing as the report viewer...

Vinoth Srinivasan [Syncfusion]
Replied On December 11, 2019 02:44 AM UTC

Hi Ahmed, 

We are validating the reported problem at our end and update you the details by 11th December 2019. 

Regards, 
Vinoth S. 


Vinoth Srinivasan [Syncfusion]
Replied On December 11, 2019 06:13 PM UTC

Hi Ahmed, 

We are still checking this with our development team and will update you the details based on their update. 

Regards, 
Vinoth S. 


Ahmed
Replied On December 12, 2019 03:47 AM UTC

Hi Vinoth,

Thank you for your efforts toward solving the issue, I really appreciate it.

Mahendran Shanmugam [Syncfusion]
Replied On December 19, 2019 01:01 PM UTC

Hi Ahmed, 

Please find the below response for your queries. 

Query 
Table 
Would you please make it possible to print in high quality (600 dpi) and a lot of pages (some reports produce 100+ pages).. 

I am saying this just to clarify that it's possible to print both in high quality and a high number of pages..  
My requirement is to allow users of my application to directly print the report in good quality.... 

Of course there is a work around (to ask the users to first export the report to excel (as exporting to PDF renders Arabic wrong) then printing that excel file) but that's a bad user experience..

On a side note, the print dialog is very much out of place, imagine your self-using a very beautiful control, then you click print and you teleport back to windows 98 interface :) It would be very nice if the printing interface was as visually appealing as the report viewer... 


By default, Report Viewer will uses the UI element for printing. So, if we increase the 600dpi image resolution for the printing document then it will causes out of memory when having larger number, We don’t have option to overcome this. But we have workaround solution to printing the document as PDF directly, so can you confirm are you expecting the requirement. 

  1. Printing the report using print button directly (without exporting the report to PDF) from the application.
  2. When click print button then it will open the print preview dialog with visually appealing as the report viewer
  3. Don’t use the printer windows 98 interface for printing and use latest interface with document preview batter visual appealing.

For the above requirement we can do work around sample to achieve your requirement but this will be implemented in sample level. We will analysis this feasibility and share you the work around demo sample for this requirement by 23rd December, 2019. 

Regards, 
Mahendran S. 


Ahmed
Replied On December 19, 2019 08:33 PM UTC

Hello Mahendran,

In the scenario you're proposing, what will be the Dpi? and what will be the maximum number of printable pages?

The requirements I am requesting are:
  1. Printing the report using print button directly (without exporting the report to PDF) from the application.
  2. When click print button then it will open the print preview dialog with visually appealing as the report viewer
  3. Don’t use the printer windows 98 interface for printing and use latest interface with document preview batter visual appealing.
  4. With Dpi setting set to at least 300, it should print 100+ pages without Out-Of-Memory exception.

Vinoth Srinivasan [Syncfusion]
Replied On December 22, 2019 07:54 AM UTC

Hi Ahmed, 

Query 
Response 
In the scenario you're proposing, what will be the Dpi? and what will be the maximum number of printable pages? 
In our proposed implementation we did not used Report Viewer UI element for printing, So, it does not depend on the DPI and we can achieve printing with good quality with more than 1000 pages. 

We will try to implement this by getting printer button click action in application level and silently export the report in PDF format (with proper Arabic text rendering) and send this document for the latest printer interface in print preview for the printing,  

Since this will be as work around in application level and it will resolve all the problem you are facing in printing, As promised we will analyze this feasibility and share you the demo sample. 

The requirements I am requesting are:
1. Printing the report using print button directly (without exporting the report to PDF) from the application. 
2. When click print button then it will open the print preview dialog with visually appealing as the report viewer 
3. Don’t use the printer windows 98 interface for printing and use latest interface with document preview batter visual appealing. 
4. With Dpi setting set to at least 300, it should print 100+ pages without Out-Of-Memory exception. 


Thanks for sharing the requirement details with us and will update you the sample on or before 24th December 2019. 
 
 
Regards, 
Vinoth S. 


Vinoth Srinivasan [Syncfusion]
Replied On December 30, 2019 12:44 PM UTC

Hi Ahmed, 

We deeply regret for the delay. We are facing some issues while preparing sample based on your requirement and will share you the sample by 2nd January 2020. 

Regards, 
Vinoth S. 


Vinoth Srinivasan [Syncfusion]
Replied On January 2, 2020 04:08 PM UTC

Hi Ahmed, 

Thanks for your patience. 

We have prepared a sample based on your requirement and it can be downloaded from below location. 


Regards, 
Vinoth S. 


Ahmed
Replied On January 2, 2020 08:21 PM UTC

Hi Ahmed, 

Thanks for your patience. 

We have prepared a sample based on your requirement and it can be downloaded from below location. 


Regards, 
Vinoth S. 

Hi Vinoth,


Thank you for your help,

But I can't access the download,

It requires me to re-login and when I do it gives me an access denied message.
This message:
Access Denied
You don’t have permission to access this file. The reason may be:
  • The incident associated with this file is not tied to the account you used to log in. To Logout use this .
  • Your enterprise portal admin has not allowed you to access other portal users’ incidents. Ask admin to change the support visibility in their Syncfusion profile.
If you feel this information is wrong and you need to download this file, please contact us.

Vinoth Srinivasan [Syncfusion]
Replied On January 3, 2020 05:10 AM UTC

Hi Ahmed, 

Sorry for the inconvenience. 

We have uploaded the sample again and it can be downloaded from below location. 


Regards, 
Vinoth S. 


Ahmed
Replied On January 3, 2020 12:45 PM UTC

Hello Vinoth,

When I rebuild the project to restore the NuGet packages, I get the following errors:
Unable to find version '17.4.1.1' of package Syncfusion.Compression.Base

and seven more like this regarding other syncfusion packages..

I am using visual studio version 16.4.2

I tried to search NuGet packages (via manage  NuGet packages option in visual studio) for a package with the same name and couldn't find any..

I googled and on the NuGet gallery I found the latest version to be 17.4.0.40..


----------------------------------------------------------

I ignored the error and ran the sample,

I got the following NullReferenceException:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=ReportViewer
  StackTrace:
   at ReportViewer.MainWindow.PrintButtonClick(Object sender, CancelEventArgs e) in D:\Cool Source Code\ReportViewer\ReportViewer\MainWindow.xaml.cs:line 65
   at Syncfusion.Windows.Reports.Viewer.ReportViewer.buttonPrint_Click(Object sender, RoutedEventArgs e)

__________

The pdfViewer.PrintDocument
is null upon inspection...

How can I solve this issue and build and use the sample?





Vinoth Srinivasan [Syncfusion]
Replied On January 3, 2020 12:53 PM UTC

Hi Ahmed, 

Sorry for the inconvenience. 

The previously shared sample having a wrong nuget version and we have now modified the sample with proper nuget version. Please find the sample from below location. 


Regards, 
Vinoth S. 


Ahmed
Replied On January 3, 2020 01:14 PM UTC

Hi Vinoth,

Thank you for your quick reply, I really appreciate it..

That indeed solved the all NuGet package issues..

But I still get the NullReferenceException whenever I attempt to print on any printer..

Namely: 

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=ReportViewer
  StackTrace:
   at ReportViewer.MainWindow.PrintButtonClick(Object sender, CancelEventArgs e) in C:\Users\ahmad\Downloads\RE49D7_1-1865500212\ReportViewer\ReportViewer\MainWindow.xaml.cs:line 65
   at Syncfusion.Windows.Reports.Viewer.ReportViewer.buttonPrint_Click(Object sender, RoutedEventArgs e)

Upon trying to debug the exception, the culprit behind it was revealed to be the PrintDocument property of the pdfViewer...

Syncfusion.Windows.PdfViewer.PdfViewerControl.PrintDocument.get returned null.


Vinoth Srinivasan [Syncfusion]
Replied On January 6, 2020 12:59 PM UTC

Hi Ahmed, 

We have validated the shared sample and the issue occurs due to the Compression base assembly version mismatch. We have modified the sample based on this and it has been working properly. You can download the sample from below link. 


Note : If the Compression Base assembly has been not restored properly in application, then please remove it and refer the assembly manually from the packages folder. 

Regards, 
Vinoth S. 


Ahmed
Replied On January 8, 2020 07:25 AM UTC

Hello Vinoth,

The same exception is thrown..

Note : If the Compression Base assembly has been not restored properly in application, 

On what criteria can I determine if the compression base is restored properly or not? 

It is shown in the nuget package manager in the installed tab with version: 17.4.0.40 beside it..

then please remove it and refer the assembly manually from the packages folder. 

How can I do that?
What I tried is: to remove the compression base by uninstalling it from the nuget package manager one would need to remove the pdfViewer too because it depends on the compression base, after doing that, and trying to add reference to the project and browsing for the compression base folder in the packages folder and selecting (which library should I select?) the latest framework dll 

then adding the pdfViewer nuget package again and rebuilding the solution 

After all that I still got the same exception as before......

Vinoth Srinivasan [Syncfusion]
Replied On January 8, 2020 02:32 PM UTC

Hi Ahmed, 

We have validated the previously shared sample and it has been working fine. However, we suspect that the issue may occurs due to 4.6 framework, so we have prepared a sample with 4.5 framework. Could you please confirm whether the below sample has been working fine at your end? 


Regards, 
Vinoth S. 


Ahmed
Replied On January 8, 2020 07:16 PM UTC

Hello Vinoth,

I have two WPF applications that need this functionality, one is targeting .Net frameweork 4.7.2 and the other is targeting .Net Core 3.1

Will this code work with them?

And have you verified all the requirements in the sample?

Namely: -the requirement that Arabic letters are rendered correctly,
-and the requirement to print high number of pages in high quality

.. because the report in the sample doesn't contain Arabic letters and is consisted of only one page...



Vinoth Srinivasan [Syncfusion]
Replied On January 10, 2020 02:05 PM UTC

Hi Ahmed, 

Query 
Response 
I have two WPF applications that need this functionality, one is targeting .Net frameweork 4.7.2
Will this code work with them?

And have you verified all the requirements in the sample?

Namely: -the requirement that Arabic letters are rendered correctly,
-and the requirement to print high number of pages in high quality

.. because the report in the sample doesn't contain Arabic letters and is consisted of only one page... 
We have prepared the Report Viewer sample with all the requirements you have mentioned in the forum and its working properly in our report viewer sample. Please refer the below report viewer sample downloadable link, 

other is targeting .Net Core 3.1 
Currently, we don’t have support for WPF Report viewer with .Net Core packages and we have already considered this as a feature. It will be included in any of our upcoming Bold Reports release. 
 

Also, as per our plan of having the reporting components as separate from our Syncfusion Essential Studio, we were introduced Bold Reports from Syncfusion. Based on this migration, will not have the further feature updates with Syncfusion Essential Studio products from now onwards. So, you need to consider migrating the reporting components with Bold Reports libraries with changes in namespace and declarations for getting new feature updates. Please refer the below getting started document. 
 
 
You can use your existing Essential Studio license to get our Report Viewer SDK from Bold Reports. Please find the details below, 
 
  1. You have to login with Bold Reports using Syncfusion account,
 
  1. Once you have logged in Bold Reports, if you are having eligible license to access of Report Viewer SDK then you can able to get the Report Viewer SDK from downloads
 
Note: If you are having any problem to get the access of Report Viewer SDK with Bold Reports then you must contact sales team to provide more details about your license and direct you to get the Report Viewer SDK in Bold Reports. 
 
  1. You can make use of the below documentation to migrate the ReportViewer component to the latest version.
 
  1. We have released Bold Reports with licensing, So, additionally you must register the license key in startup of your application as explained in below documentation,

Regards, 
Vinoth S. 


Ahmed
Replied On January 11, 2020 11:04 AM UTC

Hello Vinoth,

Thank you very much for your effort and patience with me,

I verify that the last sample is working fine according to the requirements..

And I thank you again very much..

Have a nice day and keep up the excellent work..

Regards,
Ahmed

Vinoth Srinivasan [Syncfusion]
Replied On January 12, 2020 05:24 PM UTC

Hi Ahmed, 

Thanks for your update. Please let us know if you require further assistance on this. 

Regards, 
Vinoth S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon