【问题标题】:Select HtmlToPdf - Html page saved in development and not saved but shown in production选择 HtmlToPdf - Html 页面在开发中保存但未保存但在生产中显示
【发布时间】: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");

我希望有人有线索。

【问题讨论】:

    标签: select html2pdf


    【解决方案1】:

    设置converter.Options.MaxPageLoadTime = 10 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2016-04-08
      • 2016-05-09
      • 2017-10-09
      • 1970-01-01
      • 2016-10-01
      • 2022-10-20
      • 1970-01-01
      • 1970-01-01
      • 2021-06-23
      相关资源
      最近更新 更多