htmlToPDF by Pechkin ,Web项目使用时64位锁死,其他没问题
2016-05-30 11:10
597 查看
public void GenerateReport() { string nowDate = DateTime.Now.ToString("yyyyMMddhhmmss"); string name = "Report-" + nowDate + ".pdf"; string url = Request.Url.ToString(); using (IPechkin pechkin = Factory.Create(new GlobalConfig().SetMargins(0, 0, 0, 0).SetPaperSize(250, 250))) { ObjectConfig oc = new ObjectConfig(); oc.SetPrintBackground(true) .SetLoadImages(true) .SetScreenMediaType(true) .SetPageUri(url); byte[] pdf = pechkin.Convert(oc); File.WriteAllBytes(name, pdf); //Response給用戶端下載 Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=" + name);//強制下載 Response.ContentType = "application/octet-stream"; Response.BinaryWrite(pdf); } } //需要特别注意dll的引用,libeay32.dll,libgcc_s_dw2-1.dll,mingwm10.dll,ssleay32.dll,wkhtmltox0.dll 放在根目录下,并设置属性为永远输出 Common.Logging.dll libeay32.dll libgcc_s_dw2-1.dll mingwm10.dll Pechkin.dll Pechkin.Synchronized.dll ssleay32.dll wkhtmltox0.dll
相关文章推荐
- wkhtmltopdf参数设置和下载PDF
- html文字有光晕
- html文字有光晕
- html实现滚动效果
- HTML中字体单位px pt em之间的转换
- HTML中有关表格的基本属性知识
- 代码验证浏览器是否支持html audio 和video
- HTML中有关表格的基本属性知识
- HTML自学基础
- HTML中有关表格的基本属性知识
- HTML中有关表格的基本属性知识
- 代码验证浏览器是否支持html audio 和video
- HTML中网页超链接设计
- HTML自学基础
- html 网页文本设计
- 代码验证浏览器是否支持html audio 和video
- HTML中网页超链接设计
- html 网页文本设计
- HTML自学基础
- 代码验证浏览器是否支持html audio 和video