You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a solution .NET 4.5, knockout.js, MVC where is used the NuGet component, Visual Studio Community 2017 with the latest updates, pc with Windows 10.
The NuGet package is 2.1.1, there is another package TuesPechkin.Wkhtmltox.AnyCPU 0.12.4.1
I'm new to this project which is 5 years old, written by other persons no more working here: I never used knockout before, for PDF printing from web I used in the past Crystal reports, something with ITextSharp; never heard of TuesPechkin...
On the customer test and production sites, under Windows Server, the PDF generation is working.
On my pc I have troubles, I get the error "The argument type 'TuesPechkin.WinAnyCPUEmbeddedDeployment' cannot be converted into parameter type 'TuesPechkin.IDeployment'."
In practice, there is a controller
[HttpPost]
[ValidateInput(false)]
public ActionResult GenerateReport(string data)
{
try
{
var requestObj = JObject.Parse(data);
var model = CreatePrintModel(requestObj);
var res = new Html2Pdf().GeneratePdf(model);
var fileName = requestObj["fileName"].Value<string>();
if (!fileName.EndsWith(".pdf"))
fileName += ".pdf";
Response.AddHeader("Content-Disposition", $"inline; filename={fileName}");
return File(res, "application/pdf");
}
catch (Exception ex)
{
// code for log
}
}
the error happens on GeneratePdf, which is
public byte[] GeneratePdf(PrintModel printModel)
{
using(var context = new FileDeleterContext())
{
foreach(var docHtml in printModel.Documents)
{
if(!string.IsNullOrEmpty(docHtml.HeaderHtml))
docHtml.HeaderTempUrl = $"file:///{context.CreateTempFile(docHtml.HeaderHtml)}";
if(!string.IsNullOrEmpty(docHtml.FooterHtml))
docHtml.FooterTempUrl = $"file:///{context.CreateTempFile(docHtml.FooterHtml)}";
}
var document = new HtmlToPdfDocument
{
GlobalSettings = MakeGlobalSettings(printModel)
};
var objects = printModel.Documents.Select(MakeObjectSettings);
document.Objects.AddRange(objects);
return Converter.Convert(document);
}
}
the error line is the latest code of line, return Converter.Convert(document);
Someone could hint what could be the problem?
The text was updated successfully, but these errors were encountered:
I'm working on a solution .NET 4.5, knockout.js, MVC where is used the NuGet component, Visual Studio Community 2017 with the latest updates, pc with Windows 10.
The NuGet package is 2.1.1, there is another package TuesPechkin.Wkhtmltox.AnyCPU 0.12.4.1
I'm new to this project which is 5 years old, written by other persons no more working here: I never used knockout before, for PDF printing from web I used in the past Crystal reports, something with ITextSharp; never heard of TuesPechkin...
On the customer test and production sites, under Windows Server, the PDF generation is working.
On my pc I have troubles, I get the error "The argument type 'TuesPechkin.WinAnyCPUEmbeddedDeployment' cannot be converted into parameter type 'TuesPechkin.IDeployment'."
In practice, there is a controller
the error happens on GeneratePdf, which is
the error line is the latest code of line, return Converter.Convert(document);
Someone could hint what could be the problem?
The text was updated successfully, but these errors were encountered: