EMF, SVG or how to reduce PDF size

Stimulsoft Reports.NET discussion
yoyo
Posts: 15
Joined: Tue Dec 13, 2011 9:58 am
Location: Bratislava

EMF, SVG or how to reduce PDF size

Post by yoyo »

Hello,

I have important question. I use some logo pictures in my report and I need reduce pdf file size. I tried use EMF format, but generated PDF show it like raster and it rapidly increase PDF file size. I also tried use SVG format, but I dont know way how to add this format to PDF.

Please, can you advice me , why EMF logo is converted to raster and how I can show SVG logo in PDF reports with Stimulsoft.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

EMF, SVG or how to reduce PDF size

Post by HighAley »

Hello.
yoyo wrote:I have important question. I use some logo pictures in my report and I need reduce pdf file size. I tried use EMF format, but generated PDF show it like raster and it rapidly increase PDF file size. I also tried use SVG format, but I dont know way how to add this format to PDF.

Please, can you advice me , why EMF logo is converted to raster and how I can show SVG logo in PDF reports with Stimulsoft.
Unfortunately, PDF doesn't allow include images in different formats, but bitmap images only. So all images are converted to bitmap images.

For work with images we use standard facilities of .NET Framework. So only several types of images may be added to report: bmp, gif, png, jpg, emf.

We use two algorithms for image compression which can be selected in the export settings:
1. Jpeg and deflate.
2. Deflate which better to use with simple images, for example, with vector drawings.

Thank you.
aaronrc
Posts: 23
Joined: Thu Apr 05, 2012 2:41 am

EMF, SVG or how to reduce PDF size

Post by aaronrc »

My boss has asked me about this as well, he doesn't like that the 23 page exported PDF report is 8MB. Just so I have my facts straight is the reason pdf export uses raster images instead of vector ones down to the fact that the .Net libraries used don't support vector images?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

EMF, SVG or how to reduce PDF size

Post by HighAley »

Hello.
aaronrc wrote:My boss has asked me about this as well, he doesn't like that the 23 page exported PDF report is 8MB. Just so I have my facts straight is the reason pdf export uses raster images instead of vector ones down to the fact that the .Net libraries used don't support vector images?
.Net libraries support only WMF and EMF vector formats.
But PDF format doesn't support direct embedding of any vector images.
There are two ways:
1. convert vector images into bitmap images
2. parse metafile structure to simple primitives and commands.

The second way is technically very difficult and time consuming. We don't have plans to implement it.
So at this moment there is only first solution works.

For adding logo you could use third-part library. For example, iText.

Please, send us your report template (mrt-file) with data or rendered report (mdc-file) for analysis and we'll try to give you guidelines for choosing the export parameters.

Thank you.
aaronrc
Posts: 23
Joined: Thu Apr 05, 2012 2:41 am

EMF, SVG or how to reduce PDF size

Post by aaronrc »

Ok, thanks for the clarification. I'll tweak the pdf export parameters myself to get the file size down.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

EMF, SVG or how to reduce PDF size

Post by Ivan »

Hello,

Let us know if you need any additional help.

Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

EMF, SVG or how to reduce PDF size

Post by Fabio Pagano »

I'm interested too in reducing pdf file size. If you find some solution or particular tweaking please post in this thread. Actually i've only found solutions that apply to already generated pdf (so it's not involving StimulReport), for example components that compress pdf but looses data (eg. converting images from color to grayscale or lowering resolution on already generated pdf).

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

EMF, SVG or how to reduce PDF size

Post by HighAley »

Hello.
Fabio Pagano wrote:converting images from color to grayscale
There are image compression methods other than Jpeg and Flate. In the pdf export settings you could choose Simple Monochrome, Ordered Monochrome, FloydSt.Monochrome.
Please read about it in the 16.9.10 Dither section of the Stimulsoft Reports Universal User Manual. Some of them could decrease size in the number of times.
Fabio Pagano wrote:lowering resolution on already generated pdf
You could set any resolution in the export settings.

Thank you.
bsilence
Posts: 34
Joined: Wed Feb 13, 2013 12:15 pm

Re: EMF, SVG or how to reduce PDF size

Post by bsilence »

Hello,

I'm having this problem. I tried to use the property ImageCompressionMethod to Flate, but instead of decreasing size file, it increases :)
Tried several properties that you mention in the manual when exproting to pdf, but nothing works.
I have only 1 image, so i think that's not what is making my pdf file so big...
I' m out of options, can you help me? Only one page of pdf and i get a size of 169Kb.
Also, if it helps, i'm exporting like this:

//Get report in pdf format
StiPdfExportSettings settings = new StiPdfExportSettings();
settings.UserAccessPrivileges = StiUserAccessPrivileges.PrintDocument;

MemoryStream stream = new MemoryStream();
stiReport.ExportDocument(StiExportFormat.Pdf, stream, settings);

//Get byte[] of the document
documentPDF = stream.ToArray();

Any help would be great :)

Thank you.

Best regards

Bruno Fernandes
bsilence
Posts: 34
Joined: Wed Feb 13, 2013 12:15 pm

Re: EMF, SVG or how to reduce PDF size

Post by bsilence »

In addition to previous post.
Is it possible that this is happening because i'm using business objects?
I'm just firing in all directions :)
Post Reply