1
是否有可能在iTextSharp中創建浮動圖像並使文本在其周圍流動。我在下面做了,圖像沒有插入,但只有元素。使用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
我使用的版本沒有該方法。它有一個屬性'Alignment' – Deeptechtons 2011-05-18 05:49:45
iText中的所有通用Java「get/set」方法都是iTextSharp中的屬性。在這種情況下:'myImage.Alignment = Image.TEXTWRAP;' – 2011-05-18 16:02:37
我仍然沒有得到解決。僅僅因爲我沒有收到任何來自社區的答案,我會標記這一點。 – Deeptechtons 2011-05-19 04:43:50