pruiz / WkHtmlToXSharp

C# wrapper wrapper (using P/Invoke) for the excelent Html to PDF conversion library wkhtmltopdf library.
239 stars 84 forks source link

Not working on linux #55

Open valeriob opened 5 years ago

valeriob commented 5 years ago

Hi, running the library on linux it does not seems to have the wkhtmltox0 library embedded, since it produces the following error :

 An unhandled exception has occurred while executing the request.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unabl to load shared library 'wkhtmltox0' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG env ronment variable: libwkhtmltox0: cannot open shared object file: No such file or directory at WkHtmlToXSharp.NativeCalls.wkhtmltopdf_version() at WkHtmlToXSharp.WkHtmlToPdfConverter..ctor() at WkHtmlToXSharp.MultiplexingConverter.<>c.<.ctor>b__26_0() --- End of inner exception stack trace --- at Sanford.Threading.DelegateQueue.EndInvoke(IAsyncResult result) at Sanford.Threading.DelegateQueue.Invoke(Delegate method, Object[] args) at WkHtmlToXSharp.MultiplexingConverter..ctor() at HtmlToPdfCore.Web.Controllers.HomeController.GenerateTestPdf() in C:\Dev\OnitGit\OnTms\src\HtmlToPdf\HtmlToPdfCore.Web\Controllers\HomeC ntroller.cs:line 26 at lambda_method(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExec tor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() 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.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)

the nuget packages for WkHtmlToXSharp.Linux32 version 1.2.* are all very small (20k) i doubt it has the linux lib embedded, 1.1.latest it's 15+Mb instead, looks working.

Unfortunatly version 1.1.23.22 does not work on windows either :(

Can you point me to a solution ? Valerio

pruiz commented 5 years ago

fetch a wkhtmltox0.so for your linux distro from wkhtmltopdf website, and copy it to the same folder where you are running your mono app, and try again.

Regards

On Wed, Apr 10, 2019 at 4:40 PM Valeriob notifications@github.com wrote:

Hi, running the library on linux it does not seems to have the wkhtmltox0 library embedded, since it produces the following error :

An unhandled exception has occurred while executing the request.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unabl to load shared library 'wkhtmltox0' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG env ronment variable: libwkhtmltox0: cannot open shared object file: No such file or directory at WkHtmlToXSharp.NativeCalls.wkhtmltopdf_version() at WkHtmlToXSharp.WkHtmlToPdfConverter..ctor() at WkHtmlToXSharp.MultiplexingConverter.<>c.<.ctor>b__26_0() --- End of inner exception stack trace --- at Sanford.Threading.DelegateQueue.EndInvoke(IAsyncResult result) at Sanford.Threading.DelegateQueue.Invoke(Delegate method, Object[] args) at WkHtmlToXSharp.MultiplexingConverter..ctor() at HtmlToPdfCore.Web.Controllers.HomeController.GenerateTestPdf() in C:\Dev\OnitGit\OnTms\src\HtmlToPdf\HtmlToPdfCore.Web\Controllers\HomeC ntroller.cs:line 26 at lambda_method(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExec tor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter() 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.InvokeFilterPipelineAsync() at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync() at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)

the nuget packages for WkHtmlToXSharp.Linux32 version 1.2.* are all very small (20k) i doubt it has the linux lib embedded, 1.1.latest it's 15+Mb instead, looks working.

Unfortunatly version 1.1.23.22 does not work on windows either :(

Can you point me to a solution ? Valerio

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pruiz/WkHtmlToXSharp/issues/55, or mute the thread https://github.com/notifications/unsubscribe-auth/AALq-XoK_u9tpLVdaCuqs_SEIJBrUTq8ks5vfffkgaJpZM4cnOg- .

valeriob commented 5 years ago

Thanks, I have tried that with the same result. I'm running on Ubuntu server.

pruiz commented 5 years ago

ensure you have all wkhtmltox0.so dependencies by running ldd against it.

On Wed, Apr 10, 2019 at 9:11 PM Valeriob notifications@github.com wrote:

Thanks, I have tried that with the same result. I'm running on Ubuntu server.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pruiz/WkHtmlToXSharp/issues/55#issuecomment-481824167, or mute the thread https://github.com/notifications/unsubscribe-auth/AALq-VpUxz9UszX63yA1w-RES5y9cH7Gks5vfjdOgaJpZM4cnOg- .