Two same images but appears differently in PDF

Hello,

I added two images(they are the same images of a horizontal line) into the same table cell, but they do not look the same once loaded in the PDF. Can you please show me how to fix it? Below is my code and I have attached a screenshot of how it looks in a PDF to show what I am referring to.

//====================row double underline===========================================

Aspose.Pdf.Image image2 = new Aspose.Pdf.Image(sec1);

Aspose.Pdf.Image image3 = new Aspose.Pdf.Image(sec1);

Row TableTotalCostRowUnderlineDouble = TableTotalCost.Rows.Add();

Cell TableTotalCostRowUnderlineDoubleC1 = TableTotalCostRowUnderlineDouble.Cells.Add();

TableTotalCostRowUnderlineDoubleC1.Paragraphs.Add(image2);

string s = "
";

Text t1 = new Text(s);

t1.IsHtmlTagSupported = true;

TableTotalCostRowUnderlineDoubleC1.Paragraphs.Add(t1);

TableTotalCostRowUnderlineDoubleC1.Paragraphs.Add(image3);

TableTotalCostRowUnderlineDoubleC1.ColumnsSpan = 3;

image2.ImageInfo.File = Server.MapPath("~/Images/underline.gif");

image2.ImageInfo.ImageFileType = ImageFileType.Gif;

image3.ImageInfo.File = Server.MapPath("~/Images/underline.gif");

image3.ImageInfo.ImageFileType = ImageFileType.Gif;

Thanks in advance for your help.

HI,

Thank you for considering Aspose.

You need to define Inline Paragraphs in the segment to achieve your goal. Please refer to following code.

Pdf pd = new Pdf();

Aspose.Pdf.Section sec1 = pd.Sections.Add();

Aspose.Pdf.Image img = new Aspose.Pdf.Image();

Aspose.Pdf.Image img2 = new Aspose.Pdf.Image();

Text text1 = new Text();

sec1.Paragraphs.Add(text1);

text1.Segments.Add(" ");

Segment seg1 = text1.Segments.Add();

Segment seg2 = text1.Segments.Add();

seg1.InlineParagraph = img;

seg2.InlineParagraph = img2;

sec1.Paragraphs.Add(text1);

Aspose.Pdf.Table tab = new Aspose.Pdf.Table(sec1);

Aspose.Pdf.Row r1 = tab.Rows.Add();

Aspose.Pdf.Cell cimg = new Aspose.Pdf.Cell(r1);

cimg.Paragraphs.Add(text1);

r1.Cells.Add(cimg);

tab.Rows.Add(r1);

img.ImageInfo.File = "c:\\img2.jpg";

img.ImageInfo.Title = "Mypic";

img.ImageScale = 1;

img2.ImageInfo.File = "c:\\img2.jpg";

img2.ImageInfo.Title = "My pic21";

sec1.Paragraphs.Add(tab);

pd.Save("c:\\tablpic3.pdf");

Hope it works.

Thanks.