Free Support Forum - aspose.com

Images in Cell problem

See attachment for an example of the issue (page 26 and after): the image of the first row is not inside the cell.

The code (extract) is the following:
Table table = new Table();
table.ColumnAdjustment = ColumnAdjustmentType.AutoFitToWindow;

<>
Row contentRow = table.Rows.Add();

<>
Cell contentCell = contentRow.Cells.Add();
if (column == “Image”)

{
Image image = new Image(section);
image.ImageInfo.SystemImage = ResizeImage(imageData, 48, 48);
contentCell.Alignment = AlignmentType.Center;
contentCell.Paragraphs.Add(image);
}


private System.Drawing.Image ResizeImage(byte[] data, int maxWidth, int maxHeight)
{
System.Drawing.Image fullSizeImage = System.Drawing.Image.FromStream(new MemoryStream(data));

int widthImage = fullSizeImage.Width;
if (widthImage > maxWidth)
{
widthImage = maxWidth;
}
int heightImage = fullSizeImage.Height * widthImage / fullSizeImage.Width;
if (heightImage > maxHeight)
{
widthImage = fullSizeImage.Width * maxHeight / fullSizeImage.Height;
heightImage = maxHeight;
}
System.Drawing.Image newImage = fullSizeImage.GetThumbnailImage(widthImage, heightImage, null, IntPtr.Zero);
fullSizeImage.Dispose();
return newImage;
}

I have tried multiple tests but can’t find a solution.
Is it a bug? I am using 4.1.1.0 (.Net 2)
Thanks.

Hello Jean-Christophe,

Thanks for your interest in our product.

Please try using the attached HotFix as during my testing I'm unable to notice the problem. In case you still face any problem or you've any further query, please feel free to contact.

We apologize for your inconvenience.

Sorry for the delay to reply. I have tested the HotFix but it doesn’t help.
I will create a test application so you will be able to reproduce the error.
Thanks.
JC

I suppose that when I did the test, the previous version of Aspose.PDF was still in cache.
I have done again a test with the latest version and it works fine.

Thanks again.