我正在使用wkhtmltopdf
在 ASP.NET 中将 HTML 页面转换为 PDF。以下是我的编码
protected void Button_Click(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo = new ProcessStartInfo();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = Server.MapPath("~/wkhtmltopdf/wkhtmltopdf.exe");
string arguments = "\"" + "http://localhost:51528/settings/InvoiceStatementPrint.aspx?InvoiceID=48\"" + " " + Server.MapPath("~/settings/" + "InvoiceDetail_1.pdf");
p.StartInfo.Arguments = arguments;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
p.Close();
p.Dispose();
}
URL 创建正确的页面。但 InvoiceDetail_1.pdf
生成黑页PDF。我的代码有什么问题吗?