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. Image for the cookie policy date
close icon

Changing the quality of the images in a pdf.

I'm trying to shrink the size of a pdf that contains a lot of bitmaps with the following code:


        foreach (var page in pdf.Pages.Cast<PdfPage>())
                {                   
                    foreach (var imageInfo in page.ImagesInfo)
                    {
                        var image = imageInfo.Image;
                        var pdfBitmap = new PdfBitmap(image);
                        pdfBitmap.Quality = 80;
                        page.ReplaceImage(imageInfo.Index, pdfBitmap);
                    }
                }

But this doesn't seem to have any effect.

3 Replies

GL George Livingston Syncfusion Team January 28, 2013 05:04 AM UTC

Hi Simon,

Thank you for using Syncfusion products.

We are not able to reproduce the issue. Herewith I have attached the sample with which we tried to reproduce the issue. Please try this and let us know if you have question. If you still face the problem, kindly open an incident in Direct-Trac. Please find the sample available in the link below,

ReplaceImageSample.zip

Regards,

George



SA System Administrator March 19, 2013 08:03 AM UTC

When I try to do this I lose the transparency from my images.
How can I reduce the image quality and keep the image transparency?

It also only appears to work on the first image. Only one image per page is replaced with a reduced quality image.

Thanks.




PH Praveenkumar H Syncfusion Team March 22, 2013 12:11 PM UTC

Hi Leo,

Thank you for your update,

We are able to reproduce the issue "While replacing the image Only one image per page is replaced with a reduced quality image". Please open an incident in Direct-Trac to resolve this issue.

Please let us know if you have any concern,

With Regards,
Praveen

Loader.
Live Chat Icon For mobile
Up arrow icon