wpf_写pdf

iTextSharp.text.Rectangle pageSize = new iTextSharp.text.Rectangle(1000, 500);
string imgurl = @"C:\Users\topo\Desktop\IX6TQ@0XOIB_PIJE%27LTFI.jpg";
Document document = new Document(pageSize, 10, 10, 120, 80);
PdfPTable pTable = new PdfPTable(new float[] { 180, 140, 140, 160, 180, 140, 194 });
pTable.TotalWidth = 1000;
pTable.LockedWidth = true;
PdfPCell cellll = new PdfPCell(new Paragraph("单元格"));
cellll.HorizontalAlignment = 1;
cellll.PaddingBottom = 10;
cellll.PaddingTop = 10;
cellll.BorderColor = BaseColor.BLUE;
cellll.SetLeading(1.2f,1.2f); pTable.AddCell(cellll);
iTextSharp.text.Image imag = iTextSharp.text.Image.GetInstance(imgurl);
imag.SetAbsolutePosition(50,50);
document.Add(pTable);
PdfWriter writer = PdfWriter.GetInstance(document,new FileStream(@"C:\Users\topo\Desktop\123.pdf",FileMode.Create));
document.Open();
//pdf图片
writer.DirectContent.AddImage(imag);
document.Add(new iTextSharp.text.Paragraph("hello worlasdasasdasdasdd"+"sdasdasd"));
document.AddTitle("标题");
document.AddSubject("主题");
document.AddKeywords("关键字");
document.AddCreator("创建者");
document.AddAuthor("作者");
document.Close();
writer.Close();

wpf_写pdf

上一篇:wpf_屏蔽按键


下一篇:《Linux和Windows下配置pip使用国内源》