SS
Sri Subhashini M
Syncfusion Team
July 29, 2009 07:32 AM UTC
Hi Andreas,
Thank you for your interest in Essential PDF.
Drawing dynamic images in table
We can achieve the behavior by choosing the images randomly. Could you please try the below code snippet in your sample and let me know if this helps?
void table_StartCellLayoutHeader(object sender, BeginCellLayoutEventArgs args)
{
int rowIndex = args.RowIndex;
int cellIndex = args.CellIndex;
Random random = new Random(3);
string[] imgPath = new string[] { @"..\..\Data\logo.png", @"..\..\Data\logo.gif", @"..\..\Data\logo.jpg" };
if (rowIndex == 0 && cellIndex == 1)
{
PdfGraphics g = args.Graphics;
PdfImage image = new PdfBitmap(imgPath[random.Next(3)]);
g.DrawImage( image,new RectangleF(args.Bounds.X+10,args.Bounds.Y,args.Bounds.Width -45,args.Bounds.Height));
}
}
Regards,
Suba