相关疑难解决方法(0)

如何使用webmatrix将图像添加到iTextSharp中的表格单元格中

我已经制作了一个带有单元格的表,并且有兴趣在其中一个单元格中创建一个图像.以下是我的代码:

doc.Open();
PdfPTable table = new PdfPTable(2);
table.TotalWidth = 570f;
table.LockedWidth = true;
table.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right

PdfPCell points = new PdfPCell(new Phrase("and is therefore entitled to 2 points", arialCertify));
points.Colspan = 2;
points.Border = 0;
points.PaddingTop = 40f;
points.HorizontalAlignment = 1;//0=Left, 1=Centre, 2=Right
table.AddCell(points);

 // add a image



doc.Add(table);
Image jpg = Image.GetInstance(imagepath + "/logo.jpg");
doc.Add(jpg);
Run Code Online (Sandbox Code Playgroud)

使用上面的代码,图像显示在我的pdf中,但我希望它在一个单元格中,以便我可以在图像的右侧添加更多单元格.

asp.net itextsharp webmatrix razor

1
推荐指数
1
解决办法
3万
查看次数

标签 统计

asp.net ×1

itextsharp ×1

razor ×1

webmatrix ×1