Page 1 of 1

Size of PDF with charts

Posted: Tue Jan 15, 2013 10:40 am
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

Re: Size of PDF with charts

Posted: Tue Jan 15, 2013 1:49 pm
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.

Re: Size of PDF with charts

Posted: Wed Jan 16, 2013 7:47 am
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

Re: Size of PDF with charts

Posted: Thu Jan 17, 2013 5:24 am
by HighAley
Hello.

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

Thank you.