Rotativa.AspNetCore
Rotativa.AspNetCore copied to clipboard
.Net Core 3.0 Compatibility
Hello,
I just wanted to inform that in .Net Core 3.0 the IHostingEnvironment has changed to IWebHostEnvironment. So when trying to configure rotativa with RotativaConfiguration.Setup(env) it throws an error about converting between the types. I was able to temporarily remedy the issue by casting the env variable to IHostingEnvironment, like so RotativaConfiguration.Setup((Microsoft.AspNetCore.Hosting.IHostingEnvironment)env), but it warns that the type is obsolete. Thanks.
I had to install the pre-release package and the overload was there.
any solution to this?
any solution to this?
Just use the overload,
Install the pre-release by putting Install-Package Rotativa.AspNetCore -Version 1.2.0-beta
in to either the console in visual code or the package manager console in visual studio.
RotativaConfiguration.Setup(env.ContentRootPath, "wwwroot/Rotativa");
Then make a folder in wwwroot call it Rotativa and put wkhtmltopdf.exe and wkhtmltoimage.exe inside it.
After upgrading to .net core 3.1, and Rotativa 1.2.0-beta, I'm getting the following error on the published version of my app: Unable to find view '[ViewName]'. The following locations were searched: ... [List of relative paths being searched]
This is when calling the ViewAsPdf function.
I can see that the view is present at the location that it says is being searched. Is it possible to see the absolute path of the search location? I'm struggling to see why its not picking up the view.
Edit:
I posted too soon; fixed it by adding the Razor runtime package (Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation) and adding it to Startup:
services.AddRazorPages().AddRazorRuntimeCompilation(); (added to ConfigureService)
Thanks for the information, it helped me to correct this error that was happening to me too.
@tstraus13 maybe close issue?
Has this fix been released?
Current mitigation: install wkhtmltopdf sudo apt update && sudo apt upgrade sudo apt install wkhtmltopdf
The default wkhtmltopdf package in Ubuntu 20.10 works with rotativa 1.2.0 beta. set env variable in Startup.cs to: RotativaConfiguration.Setup(env.WebRootPath, "/usr/bin/");
This works on Ubuntu 20.10 and most likely 20.04. It works with dotnet 5.0 and dotnet 3.1.
Hi! When I try this RotativaConfiguration.Setup(env.WebRootPath, "/usr/bin/");
I get : canot be null
Can you helpme please?