Size of PDF with charts

Stimulsoft Reports.NET discussion
Post Reply
User avatar
John
Posts: 132
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Size of PDF with charts

Post by John »

Hallo Support,

we're producing reports dynamically using c# code and templates and then exporting the reports to a MemoryStream. This all works fine. However, when we include charts, the resulting pdfs are pretty large and I'd like to find out if there is a way to reduce the size. I've included an example here. The c# code from the MRT template attached here is used to produce the pdf (see attached example). In this case there is not even any data in the two charts but the pdf file is nevertheless 4.2MB.
To export the rendered report we are using this piece of code:

Code: Select all

            var settings = new StiPdfExportSettings();
            settings.ImageQuality = 1;
            settings.ImageResolution = 300;
            settings.Compressed = true;
            settings.UserAccessPrivileges = StiUserAccessPrivileges.All;

            using (var stream = new MemoryStream())
            {
                stiReport.ExportDocument(StiExportFormat.Pdf, stream, settings);
                return stream.ToArray();
            }
I chose the ImageQuality and ImageResolution values after quite a lot of experimenting. If I reduce them, the loss of quality in the graphics is noticible for the end user. Is there a way I can reduce the final file size without changing these two values?

Thanks and regards,

John Kitching
Attachments
KVDetailsDoubleChart.mrt
MRT Template
(30.61 KiB) Downloaded 407 times
report.pdf
Resulting pdf
(4.11 MiB) Downloaded 221 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Size of PDF with charts

Post by HighAley »

Hello.

At this moment all charts are exported as image.
So, please, try to set the Stimulsoft.Report.Export.StiPdfExportSettings.ImageCompressionMethod property to StiPdfImageCompressionMethod.Flate.
It will decrease the exported file size.
We have in plans to export chats in vector but couldn't write about the terms now.

Thank you.
User avatar
John
Posts: 132
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Re: Size of PDF with charts

Post by John »

Hallo Alexsey,

thanks very much for the simple solution. On a test report similar to the one I attached as an example it made a reduction from 5MB to 500kB! - With no noticible loss of quality.

Best regards,

John Kitching
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Size of PDF with charts

Post by HighAley »

Hello.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Post Reply