看效果图
 
/// <summary>
/// 赛事结果PDF
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
private static string PDFDownRunLoad(RunningModel model)
{
try
{
//BaseFont font = BaseFont.CreateFont(@"C:\Users\IT-016\Documents\Kitematic\jenkins\var\jenkins_home\war\css\font-awesome\fonts\fontawesome-webfont.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
//获取PDF模板文件 string templateFile="";
if (model.MasterGroupType== "")
templateFile = AppDomain.CurrentDomain.BaseDirectory + @"PDF\Dom\e-Cert-V1-10K.pdf";
else
templateFile = AppDomain.CurrentDomain.BaseDirectory + @"PDF\Dom\e-Cert-V1-5K.pdf"; //输出生成的PDF文件
var fileName = @"PDF\" + model.RunId + "-" + model.AthleteNO + "_Run.pdf";
string tempPDF = AppDomain.CurrentDomain.BaseDirectory + fileName; PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(templateFile); //获取PDF文档第一页
PdfPageBase page = pdf.Pages[]; //添加文本水印到第一页,并设置格式
PdfTilingBrush brush = new PdfTilingBrush(new SizeF(page.Canvas.ClientSize.Width, page.Canvas.ClientSize.Height));
//brush.Graphics.SetTransparency(0.3f);
//brush.Graphics.Save();
//brush.Graphics.TranslateTransform(brush.Size.Width / 2, brush.Size.Height / 2);
//brush.Graphics.RotateTransform(-45);
//y 控制高度 增大下滑
//x 控制长度 增大右滑
Font font = new Font("华康俪粗黑", , FontStyle.Bold);
PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(font, true); Font font2 = new Font("华康俪中黑", , FontStyle.Regular);
PdfTrueTypeFont trueTypeFont2 = new PdfTrueTypeFont(font, true); var run_Model = JsonConvert.DeserializeObject<ExcelModel>(model.SGL_Run_IPbusiness); brush.Graphics.DrawString(model.AENName, trueTypeFont, PdfBrushes.Black, , -, new PdfStringFormat(PdfTextAlignment.Center));
//brush.Graphics.DrawString(model.AthleteNO, new PdfFont(PdfFontFamily.Helvetica, 18), PdfBrushes.Black, 440, 208, new PdfStringFormat(PdfTextAlignment.Center));
brush.Graphics.DrawString(model.AthleteNO, new PdfFont(PdfFontFamily.Helvetica, ), PdfBrushes.Black, +, +, new PdfStringFormat(PdfTextAlignment.Center));
brush.Graphics.DrawString(run_Model.FinishTime, new PdfFont(PdfFontFamily.Helvetica, ), PdfBrushes.Black, +, +, new PdfStringFormat(PdfTextAlignment.Center));
brush.Graphics.DrawString(run_Model.NetTime, new PdfFont(PdfFontFamily.Helvetica, ), PdfBrushes.Black, +, +, new PdfStringFormat(PdfTextAlignment.Center)); brush.Graphics.Restore();
brush.Graphics.SetTransparency();
page.Canvas.DrawRectangle(brush, new RectangleF(new PointF(, ), page.Canvas.ClientSize)); //保存文档
pdf.SaveToFile(tempPDF);
return @"\" + fileName;
}
catch (Exception ex)
{
return "";
}
}

 具体代码如上图所示

下载DLL地址
http://note.youdao.com/noteshare?id=445c577476c7a69b3e87e121d538f6b8

最新文章

  1. CI框架代码运行最详细的流程
  2. HDU 3622 Bomb Game
  3. cp命令
  4. WRONGTYPE Operation against a key holding the wrong kind of value
  5. django 1.5+ 权限设计浅析
  6. 事务并发处理: DB+ORM+逻辑代码
  7. 移动端material风格日期时间选择器
  8. Keil的c语言编译器
  9. [wikioi]乌龟棋
  10. jersey + tomcat 实现restful风格
  11. 业余写的一个播放器SDK,求点意见
  12. Oak Seeds 网站项目回顾
  13. [0] C#实现WebBrowser&amp;HTML交互
  14. python基础笔记(一)
  15. this.$router.push、replace、go的区别
  16. Docker-----仓库
  17. 打包优化实践(如何Code Spliting)
  18. jdk安装及配置
  19. C#使用AppDomain时的异常分析:Object ‘XXXX.rem’ has been disconnected or does not exist at the server.
  20. 如果在springboot中设置了 修改了默认页面的指向 使用thymleaf模板 而请求不到静态资源 可能是

热门文章

  1. 阶段5 3.微服务项目【学成在线】_day02 CMS前端开发_15-webpack研究-webpack-dev-server-程序调试
  2. 在谷歌中缓存下载视频离线观看,js代码
  3. .Netcore 2.0 Ocelot Api网关教程(8)- 缓存
  4. python-Web-flask-视图内容和模板
  5. CentOS 7安装gevent
  6. IDEA debug漏洞第一篇(weblogic,cve-2017-10271)
  7. 亿级mongodb数据迁移
  8. 带你手写基于 Spring 的可插拔式 RPC 框架(三)通信协议模块
  9. [转帖]postgresql查看用户连接以及杀死连接的会话
  10. thinkphp中return $this-&gt;fetch的问题