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

Free Support Forum - aspose.com

Insert image not working as expected,

Hello Support,
Attached the aspx file with image.
I am using Insertimage method with width and height of the image, But I can see difference in Browser view and Docx view.

Is there anything I missed here.
Please advise.
Thanks
PatrickAspose_Size.zip (21.9 KB)

@patrickjjs,

Thanks for your inquiry. Please use ConvertUtil.PixelToPoint method as shown below in your code to get the desired output.

double widthofimage = ConvertUtil.PixelToPoint(150);
double heightofimage = ConvertUtil.PixelToPoint(47);

builder.InsertBreak(BreakType.LineBreak);
builder.InsertBreak(BreakType.LineBreak);
builder.InsertBreak(BreakType.LineBreak);

builder.InsertImage(@"bjork67.gif", widthofimage, heightofimage);

builder.InsertBreak(BreakType.LineBreak);
builder.InsertBreak(BreakType.LineBreak);
builder.InsertBreak(BreakType.LineBreak);

builder.InsertImage(@"bjork67.gif", RelativeHorizontalPosition.LeftMargin, 60, RelativeVerticalPosition.TopMargin, 50, widthofimage, heightofimage, WrapType.None);