【发布时间】:2022-07-16 20:40:11
【问题描述】:
我在保存和不显示要转换为 pdf 的页面时遇到问题。我使用的代码在 Visual Studio 中运行良好,但在 IIS 中运行良好。在开发机器上,它转换 HTML 页面,保存 pdf,然后重定向。在带有 IIS 的“生产”机器上,它显示 html 页面(FactuurPDF),但停在那里。 我想要的是开发机器上的行为。 这是我的代码:
// other stuff
HtmlToPdf converter = new HtmlToPdf();
var TxtUrl = "";
TxtUrl = "https://localhost:44368/Facturen/FactuurPDF" + "?id=" + id + "&fact=" + fact;
PdfDocument doc = converter.ConvertUrl(TxtUrl);
var dat = DateTime.Today.ToString("yyyy-MM-dd");
doc.Save(@Path.Combine(_env.WebRootPath, "Verzondenfacturen/Fact_" + id + "_" + dat + ".pdf"));
doc.Close();
//other stuff (email pdf and update database)
return LocalRedirect("/Facturen/Index");
我希望有人有线索。
【问题讨论】: