OpenHtmlToPdf.netcore not working on linux

Vitor Lacerda 0 Reputation points
2023-06-27T20:03:13.6966667+00:00

I switched to linux and since then the OpenHtmlToPdf stoped working. I was getting the permission error, I changed the permission for the file that was giving the error and worked, but now I am getting another error that returns a base64 that says "Platform Unix is not supported". How can I get this to work again?

OpenHtmlToPdf.PdfDocumentCreationFailedException: UGxhdGZvcm0gVW5peCBpcyBub3Qgc3VwcG9ydGVk
   at OpenHtmlToPdf.HtmlToPdfConverterProcess.RaiseExceptionIfErrorOccured(Process process)
   at OpenHtmlToPdf.HtmlToPdfConverterProcess.Convert(Process process, ConversionSource conversionSource)
   at OpenHtmlToPdf.HtmlToPdfConverterProcess.Convert(ConversionSource conversionSource)
   at OpenHtmlToPdf.HtmlToPdfConverterProcess.ConvertToPdf(String html, IDictionary`2 globalSettings, IDictionary`2 objectSettings)
   at OpenHtmlToPdf.Pdf.DocumentBuilder.ReadContentUsingTemporaryFile(String temporaryFilename)
   at OpenHtmlToPdf.Pdf.DocumentBuilder.Content()
   at Application.Services.PrintAppService.CreatePDF(Billing billing, List`1 lastMonths, Decimal allEconomy) in /home/vitor/Projects/Hipatia/Application/Services/PrintAppService.cs:line 113
   at Application.Services.BillingAppService.Print(Guid billingId) in /home/vitor/Projects/Hipatia/Application/Services/BillingAppService.cs:line 1467
   at WebApi.Controllers.BillingController.Print(Guid billingId) in /home/vitor/Projects/Hipatia/WebApi/Controllers/BillingController.cs:line 173
   at lambda_method1280(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
Developer technologies | .NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-06-27T21:14:07.6933333+00:00

    the library uses the wkhtmltopdf command line tool.:

    https://wkhtmltopdf.org

    the nuget package includes the windows version of the tool (OpenHtmlToPdf.WkHtmlToPdf.exe). you will need to replace it with a version that supports your o/s.

    https://wkhtmltopdf.org/downloads.html

    note: the exe name is hardcoded to "OpenHtmlToPdf.WkHtmlToPdf.exe", so you may need to rename to match.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.