关闭

htmlToPDF by Pechkin ,Web项目使用时64位锁死,其他没问题

766人阅读 评论(0) 收藏 举报
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 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:51542次
    • 积分:1079
    • 等级:
    • 排名:千里之外
    • 原创:56篇
    • 转载:37篇
    • 译文:0篇
    • 评论:3条