是否可以在 iTextSharp. 我做了下面的,没有插入图像,只插入了元素。
Document doc = new Document();
PdfWriter.GetInstance(doc, new FileStream(Path, FileMode.Create));
doc.Open();//open the document
PdfPTable table = new PdfPTable(6);
table.WidthPercentage = 80;
table.HorizontalAlignment = Element.ALIGN_CENTER;//80% centered
Image imgLogo = Image.GetInstance(Server.MapPath("~/Images/image.png"));
imgLogo.Alignment = Element.ALIGN_LEFT;
imgLogo.Alt = "Company has sent you a Invoice";
PdfPCell cell = new PdfPCell(providerLogo);//added image to cell
cell.PaddingLeft = 10;//left padding 10px
cell.AddElement(new Phrase("Company Name"));
cell.AddElement(new Paragraph("California"));
cell.Colspan = 3;
cell.HorizontalAlignment = Element.ALIGN_LEFT;
table.AddCell(cell);//Added cell with image and text but no Image at all
cell = new PdfPCell(new Phrase("INVOICE"));
cell.Colspan = 3;
table.AddCell(cell);
doc.Add(table);
doc.Close();//close the document
有人可以更正代码。我需要做什么才能使图像像此链接Stackoveflow Link中一样浮动