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

PDFImage Problems

hi,

my code:

PdfImage pdfImage = PdfImage.FromImage(image);

the size of image is set correctly but the pdfImage's PhysicalDimensions are smaller than the dimension it will be drawn by

Graphics.DrawImage(pdfImage , result.Bounds.X, result.Bounds.Y);

how can i solve the problem?

Reaper


2 Replies

BP Bhuvaneswari P Syncfusion Team April 22, 2009 11:36 AM UTC

Hi Reaper,

Thank you for your inquiry.

I am able to reproduce the issue. The issue reported by you is suspected to be a defect. We have forwarded this to our Development Team for further analysis. We will update you with our Development Team’s response in two business days.

Thank you for your patience.

Best Regards,
Bhuvana




BP Bhuvaneswari P Syncfusion Team April 24, 2009 09:51 AM UTC

Hi Reaper,

Thank you for your patience.

The difference in Image Size and PhysicalDimension is image size return in Pixels and PhysicalDimension returns in Points.

Since Image size is return .Net image size and for PhysicalDimension we have internally overrides and converted to points to draw into the PDF.

So please use the PdfUnitConvertor class to convert the Points to Pixel. This will return the correct the dimension.

PdfImage image = new PdfBitmap(System.Drawing.Image.FromFile(@"..\..\Image.jpg"));
PdfUnitConvertor con = new PdfUnitConvertor();
SizeF size = con.ConvertToPixels(image.PhysicalDimension, PdfGraphicsUnit.Point);
MessageBox.Show("Sync Physical" + size.ToString());

Please try this and let us know if you need any more details.

Best Regards,
Bhuvana



Loader.
Live Chat Icon For mobile
Up arrow icon