HakanL / WkHtmlToPdf-DotNet

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.
GNU Lesser General Public License v3.0
372 stars 67 forks source link

Ubuntu 22.04 - Unable to load native library #80

Closed tpurschke closed 2 years ago

tpurschke commented 2 years ago

When running on Ubuntu 22.04 I get the "usual" error message: One or more errors occurred. (Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.)

Working fine on all other platforms tested: 18.04, 20.04, debian 10 + 11 Has anyone been able to get it to run on Ubuntu 22.04?

Installed libraries on test system:

tim@fwo-ubu22-desktop$ dpkg -l | grep -e gdiplus -e libc6 -e jpeg -e pdf
ii  libc6:amd64                                2.35-0ubuntu3                           amd64        GNU C Library: Shared libraries
ii  libc6:i386                                 2.35-0ubuntu3                           i386         GNU C Library: Shared libraries
ii  libc6-dbg:amd64                            2.35-0ubuntu3                           amd64        GNU C Library: detached debugging symbols
ii  libc6-dev:amd64                            2.35-0ubuntu3                           amd64        GNU C Library: Development Libraries and Header Files
ii  libgdiplus                                 6.0.4+dfsg-2                            amd64        interface library for System.Drawing of Mono
ii  libjpeg-turbo8:amd64                       2.1.2-0ubuntu1                          amd64        IJG JPEG compliant runtime library.
ii  libjpeg62:amd64                            1:6b2-3                                 amd64        Independent JPEG Group's JPEG runtime library (version 6.2)
ii  libjpeg8:amd64                             8c-2ubuntu10                            amd64        Independent JPEG Group's JPEG runtime library (dependency package)
ii  libqpdf28:amd64                            10.6.3-1                                amd64        runtime library for PDF transformation/inspection software
ii  wkhtmltopdf                                0.12.6-2                                amd64        Command line utilities to convert html to pdf or image using WebKit
tim@fwo-ubu22-desktop$
HakanL commented 2 years ago

Hmm, there may be some other dependency in that environment, I have not tested Ubuntu 22.

tpurschke commented 2 years ago

you were right:

By downloading and installing the pre-compiled version from https://wkhtmltopdf.org/downloads.html found the missing dependency.

So the following package installation makes PDF generation possible on ubuntu 22.04:

sudo apt install libgdiplus libc6-dev libjpeg62 xfonts-75dpi

Thanks Hakan for pointing me in the right direction.

HakanL commented 2 years ago

Excellent, thanks for posting the solution here @tpurschke!