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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to draw a ''dynamic'' image in cell

Thread ID:





88520 Jul 28,2009 01:41 PM UTC Jul 29,2009 07:32 AM UTC WinForms 1
Tags: PDF
Andreas Hirtzel
Asked On July 28, 2009 01:41 PM UTC


I'd like to draw an image in a PdfLightTable cell. The only sample I have found shows how to use the BeginCellLayout event and there will be drawn a static image in the cell. What I'd like to achieve is to draw a dynamic image. How can I do this?

Sri Subhashini M [Syncfusion]
Replied On 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));



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon