Rotativa.AspNetCore
Rotativa.AspNetCore copied to clipboard
Win32Exception: The specified executable is not a valid application for this OS platform.
Got Win32Exception while creating pdf from aspnet core mvc application. I am targeting .Net core 2.1 framework on Win 10 64 bit OS. Following is the stacktrace from exception.
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) System.Diagnostics.Process.Start() Rotativa.AspNetCore.WkhtmlDriver.Convert(string wkhtmlPath, string switches, string html, string wkhtmlExe) Rotativa.AspNetCore.WkhtmltopdfDriver.ConvertHtml(string wkhtmltopdfPath, string switches, string html) Rotativa.AspNetCore.ViewAsPdf.CallTheDriver(ActionContext context) Rotativa.AspNetCore.AsResultBase.BuildFile(ActionContext context) Rotativa.AspNetCore.AsResultBase.ExecuteResultAsync(ActionContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync<TFilter, TFilterAsync>() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync() Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Do you have wkhtmltopdf executable in your project under /wwwroot/Rotativa/wkhtmltopdf.exe, and have you configured Rotativa in Startup.cs?
Having exactly the same issue on Windows 10 Pro, 64 bit. Everything is set well but I get exactly the error above using .Net Core 2.0
Please were you able to solve this? How?
I found the solution. Simply download the repo, compile on your machine and then copy the wkhtmltopdf.exe from the sample project and use.
I found the solution. Simply download the repo, compile on your machine and then copy the
wkhtmltopdf.exefrom the sample project and use.
This worked for me. Pretty random. Thank you for suggesting this!