[英]Adding hundreds of Images to pdf using itextsharp
如何使用itextsharp向PDF添加數百個圖像(其實際大小沒有任何縮小/壓縮)。 我想以某些表格格式添加這些內容,並修復每個pdf頁面中沒有圖像的問題。 所有圖像的大小相同。 我該怎么做?
您可以嘗試使用此代碼以pdf格式添加圖像
Document doc = new Document(PageSize.A4, 10, 10, 30, 30);
MemoryStream PDFData = new MemoryStream();
PdfWriter writer = PdfWriter.GetInstance(doc, PDFData);
doc.Open();
PdfPTable table = new PdfPTable(1);
table.WidthPercentage = 100F;
Image imgLogo = Image.GetInstance(<image_path>);
PdfPCell cell1 = new PdfPCell { BorderWidth = 0F, Padding = 3 };
cell1.AddElement(imgLogo);
table.AddCell(cell1);
//Add your more images.
doc.Add(table );
doc.Close();
writer.Close();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.