复制代码 代码如下:
public static bool CreatePPDF(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("~/afafafasf/PageToPDF.exe ");
if (!System.IO.File.Exists(str))
return false;
p.StartInfo.FileName = str;
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(500);
return true;
}
catch(Exception ex)
{
Sys.Log.error("Pdf create err.",ex);
}
return false;
}
新闻热点
疑难解答
图片精选