webgio / Rotativa.AspNetCore

Rotativa for Asp.Net Core
MIT License
268 stars 121 forks source link

System.Exception at Rotativa.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html, String wkhtmlExe) in /Users/codeflow/Downloads/Rotativa.NetCore-master/Rotativa.NetCore/WkhtmlDriver.cs:line 78 #5

Open c0deflow opened 6 years ago

c0deflow commented 6 years ago

If try to run the Sample, and click on "Test Pdf Generation", I get following exception:

System.Exception at Rotativa.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html, String wkhtmlExe) in /Users/codeflow/Downloads/Rotativa.NetCore-master/Rotativa.NetCore/WkhtmlDriver.cs:line 78 at Rotativa.NetCore.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches) in /Users/codeflow/Downloads/Rotativa.NetCore-master/Rotativa.NetCore/WkhtmltopdfDriver.cs:line 27 at Rotativa.NetCore.AsPdfResultBase.WkhtmlConvert(String switches) in /Users/codeflow/Downloads/Rotativa.NetCore-master/Rotativa.NetCore/AsPdfResultBase.cs:line 79 at Rotativa.NetCore.AsResultBase.CallTheDriver(ActionContext context) in /Users/codeflow/Downloads/Rotativa.NetCore-master/Rotativa.NetCore/AsResultBase.cs:line 185 at Rotativa.NetCore.AsResultBase.BuildFile(ActionContext context) in /Users/codeflow/Downloads/Rotativa.NetCore-master/Rotativa.NetCore/AsResultBase.cs:line 205 at Rotativa.NetCore.AsResultBase.ExecuteResult(ActionContext context) in /Users/codeflow/Downloads/Rotativa.NetCore-master/Rotativa.NetCore/AsResultBase.cs:line 217 at Microsoft.AspNetCore.Mvc.ActionResult.ExecuteResultAsync(ActionContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeResultAsync>d__30.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResultFilterAsync>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResultExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()

Is there a workaround? Inside the bin/debug/myapp/rotativa I've the required files/ddl's (wkhtmltoimage.exe, wkhtmltopdf.exe, wkhtmltox.dll).

saineshwar commented 6 years ago

which version of .Net Core you are using

c0deflow commented 6 years ago

Hi saineshwar! I am using .Net Core 2.0.

saineshwar commented 6 years ago

hi @c0deflow !

Can you try this sample by downloading it. https://www.dropbox.com/s/owuix133ni4el0o/DemoRotativa.rar?dl=0

c0deflow commented 6 years ago

Wow! I saw your article already @saineshwar the link was looking very familiar! I followed your tutorial but since 1 week I stared crying to create a pdf from core because nothing worked for me right now or the product costs over 700 dollar.

Your example is also not working for me, sadly. I get a new exception. Permission denied! Well, I used this tool right here: https://www.macupdate.com/app/mac/31741/permissions-reset

In this project, I ran Demo/DemoViewAsPDF

and gave the highest permission that I can (read, write, executable). But now I get this exception here:

An unhandled exception occurred while processing the request. Exception: Rotativa.AspNetCore.WkhtmlDriver.Convert(string wkhtmlPath, string switches, string html, string wkhtmlExe)

System.Exception at Rotativa.AspNetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html, String wkhtmlExe) at Rotativa.AspNetCore.WkhtmltopdfDriver.ConvertHtml(String wkhtmltopdfPath, String switches, String html) at Rotativa.AspNetCore.ViewAsPdf.<CallTheDriver>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Rotativa.AspNetCore.AsResultBase.d65.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Rotativa.AspNetCore.AsResultBase.d66.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d24.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d22.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.d15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.d4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.d__7.MoveNext()`

saineshwar commented 6 years ago

can u provide me you source code sample such that i can try it.

Have you download latest code from github of Rotativa.AspNetCore , do not use Nuget it has issue.

c0deflow commented 6 years ago

I downloaded the dropbox project from your link. I got this Exceptions also in this project. But I can upload the same project to dropbox if you like. here is the link: Download Link

c0deflow commented 6 years ago

By the way, I am using macOS Sierra v 10.12.6 My .Net Core Version 2.1.4 (dotnet --version in terminal) but in the Project itself I am using 2.0. I hope I didn't provide you the wrong version previously,

saineshwar commented 6 years ago

ohh it might be issue because it works fine on windows machine .

c0deflow commented 6 years ago

@saineshwar no hope for mac? :-( Because there are one or more ddl which can be used but yeah I saw also .exe ...

webgio commented 6 years ago

@c0deflow there's still an issue with wkhtmltopdf filename that needs fixing. Dirty fix is to change name adding ".exe" suffix. it should work then, I now at least one guy that made it work.

c0deflow commented 6 years ago

@webgio how do U mean? Is it correct how it looks like in my attached image:

screen shot 2018-03-13 at 12 06 20
saineshwar commented 6 years ago

@c0deflow your source works fine on windows , @webgio is there any issue on running this product on mac.

webgio commented 6 years ago

I had confirmation that it works. I'll ping the guy to ask him. Let you know

c0deflow commented 6 years ago

@saineshwar @webgio thank you guys for your help. Hope it would work on mac/linux.

c0deflow commented 6 years ago

@webgio Did U get any updates ?

MeyramAlshinov commented 6 years ago

@c0deflow Hello! Did you resolve this issue ? I have an identical error on linux

c0deflow commented 6 years ago

Hi @Meyram . Nope. I was waiting for an answer from webgio, but didn't get an answer. So I changed to "DinkToPdf". This worked for me.

neobarcino commented 5 years ago

Hi,

I had same problem: System.Exception at Rotativa.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html, String wkhtmlExe) in /Users/codeflow/Downloads/Rotativa.NetCore- ...

If your problem is that Rotative does not find the wkhtmltopdf.exe path, you could try to change it throught the WkhtmlPath property in ViewAsPdf object:

// Try this minimal example var test = new ViewAsPdf(model); test.WkhtmlPath = "c:\path_of_wkhtmltopdf\"; return test;

This worked for me.

webgio commented 5 years ago

@neobarcino did you try the last package version? it should fix problems when running on Mac or Linux. If you need to define the directory where wkhtmltopdf is then use RotativaConfiguration.Setup(env, "path/relative/to/root")

neobarcino commented 5 years ago

Great! Thanks webgio! I'm using Rotative 2.2.0 on Core 2.0

Will-at-FreedomDev commented 2 years ago

I came across this open issue with the same error. I ended up just updating the files with a newer version than what we were using. Not sure why this error happened in the first place, but that was the fix for us.