Mike Margolius

Mike Margolius

  • NA
  • 27
  • 262

How do I save a .net core view to PDF

Dec 31 2017 12:23 PM
I am trying to save a .net core view (cshtml) to PDF. I am using Rotativa.NetCore(1.0.4) When I call the routine from my view I get an error mesage.
 
I will appreciate any assistance on this.
 
TypeLoadException: Could not load type 'Microsoft.AspNetCore.Builder.CookieAuthenticationOptions' from assembly 'Microsoft.AspNetCore.Authentication.Cookies, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
 
The following NuGet packages are installed:
 
Microsoft.AspNetCore.All(2.0.3)
Microsoft.AspNetCore.Mvc(2.0.1)
Microsoft.Aspnetcore.Authentication.Cookies(2.0.1)
Rotativa.NetCore(1.0.4)
RotativaCore(2.1.1)
 
I have the following code in my Controller:
 
public IActionResult GetSign()
{
var sign = new List<Sign>
{
new Sign {Name = "Rami1", Company = "Rami",DateSigned=DateTime.Now},
new Sign {Name = "Rami2", Company = "Rami",DateSigned=DateTime.Now}
};
return View(sign);
}
public ActionResult GeneratePDF()
{
return new Rotativa.NetCore.ActionAsPdf("GetSign");
}

Answers (1)