Aspose PDF demo

I can see the example of how you include a image in the “Catalog example” as in the header.

What I would like to do is at the cell level I have a image named checked.gif and unchecked.gif if value is <> 0 the checked otherwise unchecked. My sample is followings like this

Dim cell2Text1Seg1 As Segment
dim insertImage as string

if rval <> 0 then
insertImage = “checked.gif”
else
insertImage =“unchecked.gif”
end if

cell2Text1Seg1 = cell2Text1.Segments(0)
cell2Text1Seg1.Content = InsertImage
cell2Text1Seg1.TextInfo.Color.RgbColorSpace = System.Drawing.Color.Blue
cell2Text1Seg1.TextInfo.Alignment = AlignmentType.Left



Any help on what I am doing wrong would be apprecitate.

Thanks

Tiny



Dear Tiny,

Thanks for your consideration.

You can’t add image to a text paragraph. You need to add a image paragraph to the cell like this:

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image(section);
cell2.Paragraphs.Add(image1);

image1.ImageInfo.File = imagePath + InsertImage;