首页 > Windows开发 > 详细

wpf_写pdf

时间:2020-09-04 09:57:57      阅读:57      评论:0      收藏:0      [点我收藏+]

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

原文:https://www.cnblogs.com/Aetly/p/13611945.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!