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

retrieve image dimention info wrong

I just want to attach an image on the pdf.
So I use the following code to implement this.
Dim image as new PdfBitmap("c:\temp\20180810.jpg")
Dim iwidth as Single = image.Width
Dim iheight as Single = image.Height
But the weird thing is I found it read the image width as the height and read the image height as the width, then when I draw the image on pdf, it rotate the image 90 degree. Not every image file it read like that, only a few jpg files cause this problem, but it is really annoying as clients complained why their image being rotated.
Please find the attachment is the that image file. Can you shed me a light?

Attachment: 20180810_b5a41868.zip

1 Reply

KC Karthikeyan Chandrasekar Syncfusion Team November 26, 2018 11:55 AM UTC

Hi Tony,  
We have tried the sample to insert image into PDF with the provided image file. We were able to view the wrong image dimension. This behavior occurs because, some Bitmap objects does not take into account the EXIF Orientation tag. The EXIF (Exchangeable Image File Format) standard specifies some set of tags that can be embedded in images. One of these tags specifies the orientation of the image. If it does take into the account, the image get rotated. This behavior will be reproduced even in System.Diagram.Bitmap. However, we have created the sample to draw the image properly to PDF page without any rotation. Please find the sample for the same from below location,  

Please try this workaround sample in your end and let us know whether it solves the issue.    

Live Chat Icon For mobile
Up arrow icon