我正在尝试使用 NRecosite HTML 到 PDF 生成器。
每当涉及到
new NReco.PdfGenerator.HtmlToPdfConverter()
它抛出异常
FileNotFoundException:无法加载文件或程序集“System.Web,版本=2.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a”。该系统找不到指定的文件。
[HttpPost]
public async Task<IActionResult> Login(RegistrationModel model, CommandType command)
{
int selectedTab = 9;
if (command == CommandType.SignApplication)
{
selectedTab = 10;
string htmlContent = await GetHtml(model.Review.PublishUrl);
var htmlToPdf = new NReco.PdfGenerator.HtmlToPdfConverter();
var pdfBytes = htmlToPdf.GeneratePdf(htmlContent);
return File(pdfBytes, "application/pdf", "dd.pdf");
}
RegistrationManager mgr = new RegistrationManager(_registrationRepository);
var registrationModel = await mgr.CreateLoginModel(model.FormId, model.LeadId, selectedTab);
return registrationModel.IsRegistrationDisbaled ? View("Error", "The link is disabled for this account") : View("Index", registrationModel);
}