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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

float width = image.PixelWidth * 0.3f; float height = image.PixelHeight * 0.3f;

Thread ID:





125986 Sep 15,2016 08:45 PM UTC Sep 21,2016 02:51 PM UTC ASP.NET MVC 5
Tags: PDF
Asked On September 15, 2016 08:45 PM UTC

Can do somesting like this
                            float width = image.PixelWidth * 0.3f;
                            float height = image.PixelHeight * 0.3f;
to make even large pictures fit on my pdf page ?

Chinnu Muniyappan [Syncfusion]
Replied On September 16, 2016 08:08 AM UTC

Hi Mvxyc, 

Thank you for contacting Syncfusion support. 

Yes, it is possible to fit large image to the PDF page while using PdfGrapics.DrawImage method, could you please refer the below code snippet and sample for more details. 
            //Load the image 
            PdfBitmap bitmap = new PdfBitmap(path);            
            //Get the page size 
            SizeF pageSize = page.GetClientSize();            
            //Draw the image to the PDF page 
            page.Graphics.DrawImage(bitmap, new RectangleF(PointF.Empty,pageSize)); 

Sample link: 


Replied On September 17, 2016 11:03 AM UTC

Actiually I need something where any picture will be scaled down to a special resolution ,without loosing the details in its picture, so when i scroll into the image i still get the same detail despite its resolution for example 480X480px (before scaling it was 1200X2800 px) for example

Karthik Krishnaraj [Syncfusion]
Replied On September 19, 2016 12:23 PM UTC

Hi Mvxyc,  
Currently we don’t have direct support to change resolution of the image, but we can achieve using external code to resize the image. I have attached a simple sample for your reference kindly check through it and let us know whether it meets your need. 
Sample Link: 

Replied On September 20, 2016 05:14 AM UTC

But after zooming in the picture lost all its details , this shouldnt be like this

Karthik Krishnaraj [Syncfusion]
Replied On September 21, 2016 02:51 PM UTC

Hi Mvxyc, 
As we said earlier we don’t have direct support to change resolution of the image, in the meantime we tried to replicate the same using system.drawing even in this case the image details are lost when the image is resized, which tends to be normal behavior. Hence we couldn’t proceed further in this case, let me know if you have any other queries. 
Sample Link: 


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