wkhtmltopdf 导出pdf
文件大小: 5655k
源码售价: 10 个金币 积分规则     积分充值
资源说明:导出网页到pdf工具。。 public static bool HtmlToPdf(string url, string path) { try { if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(path)) return false; Process p = new Process(); string str = System.Web.HttpContext.Current.Server.MapPath("~/wkhtmltopdf.exe"); if (!System.IO.File.Exists(str)) return false; string switches = "--print-media-type "; switches += "--margin-top 0mm --margin-bottom 4mm --margin-right 0mm --margin-left 0mm "; switches += "--page-size A4 "; // switches += "--no-background "; switches += "--redirect-delay 100%"; //p.SessionId == "1"; p.StartInfo.FileName = str; p.StartInfo.Arguments = switches + " " + url + " " + path; //p.StartInfo.Arguments = " \"" + url + "\" " + path; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.Start(); System.Threading.Thread.Sleep(800); // p.SessionId p.WaitForExit(); p.Close(); return true; } catch (Exception ex) { HttpContext.Current.Response.Write(ex); } return false; }
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。