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

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 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值