We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ImageScale issues

I'm having a problem with ImageScale not appearing to be consistent. I've used the below code with two different images. One is 240x84px and the other is 334x40px.

With the first image, if I view the PDF at 100% zoom then the image matches perfectly the actual pixel size of the image. But if I do the same with the second image then it's a much much smaller in the PDF than it should be.

Any pointers? (Code below)


Aspose.Pdf.Image logo = new Aspose.Pdf.Image(sec1);

Stream LogoStream = new MemoryStream(Settings.LogoFile);

logo.ImageInfo.ImageStream = (LogoStream);

logo.ImageInfo.ImageFileType = ImageFileType.Jpeg;

LogoBox.Border = new BorderInfo((int)BorderSide.All, 0.5F, new Aspose.Pdf.Color("#909090"));

logo.ImageScale = 0.663F;


LogoBox.BoxHorizontalPositioning = BoxHorizontalPositioningType.Page;

LogoBox.BoxVerticalPositioning = BoxVerticalPositioningType.Margin;


Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

As far as I can understand, the image dimensions in the resultant PDF are not correct. Instead of using the ImageScale property, please try using the ImageInfo.FixHeight and ImageInfo.FixWidth to specify the dimensions of the image. In case it does not fullfil your requirement or you've any further query, please feel free to contact.

Hi Nayyer,

Thanks you. Using FixWidth and FixHeight solved the problem for me