标签:ror name ges new 字符 大小 image res paper
Pechkin开源组件使用wkhtmlbox,可以解析CSS样式,将网页转换为PDF文件,
支持URL,或者HTML字符串
1, 从NuGet程序管理器中获得Pechkin
SynchronizedPechkin sc = new SynchronizedPechkin(new GlobalConfig()
.SetMargins(new Margins() { Left = 0, Right = 0, Top = 0, Bottom = 0 }) //设置边距
.SetPaperOrientation(true)); //设置纸张方向为横向
//.SetPaperSize(340, 594)); //设置纸张大小50mm * 100mm
ObjectConfig oc = new ObjectConfig();
oc.SetPageUri("http://localhost:40146/Styles/HTMLPage2.htm");
byte[] buf = sc.Convert(oc);
Response.AddHeader("content-disposition", "attachment;filename=1.pdf");
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(buf);
标签:ror name ges new 字符 大小 image res paper
原文地址:http://www.cnblogs.com/guichi/p/6220960.html