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
378 stars 67 forks source link

Unable to load native library on .NET8 #121

Open muraczewski opened 11 months ago

muraczewski commented 11 months ago

After upgrading from .NET 7 to .NET 8, generating pdf stopped working with the below error

image

We made one change in the Dockerfile to fix error: failed to solve: process "/bin/sh -c apt-get update && apt-get install -y --no-install-recommends zlib1g libgdiplus libc6-dev ca-certificates fontconfig fontconfig-config fonts-dejavu-core libbsd0 libexpat1 libfontconfig1 libfontenc1 libfre etype6 libjpeg62-turbo libpng16-16 libssl1.1 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxrender1 ucf x11-common xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100

image

HakanL commented 11 months ago

Ok, so your issue was fixed?

muraczewski commented 11 months ago

Nope. It only fixed the below issue with building a docker image: image

HakanL commented 11 months ago

Ok, so it's most likely one of the dependencies for the native library that aren't met. Best is to try to get the command line version of wkhtmltopdf to work in your container, then this wrapper should work after that.

nydsteven commented 11 months ago

I'm also having issues on .NET 8, but only when deploying to an Azure App Service on Linux. I haven't tested the Azure App Service on Windows, but on my Windows dev computer it works fine.

I'm not sure if that helps diagnose anything... but I also don't know what workaround is possible in my scenario outside of switching to an App Service on Windows (which costs twice as much) or trying to find a solution with Docker and deploying to a Azure App Service on Linux with Docker.

nydsteven commented 11 months ago

I was able to get the list of installed dependencies on the Azure App Service on bash, and I still get the same error as mentioned @muraczewski even though libjpeg62 is installed on the machine. Here's all of the .NET 8 dependencies on the App Service (some are different than the .NET 7 app services).

Edit: please ignore the strikethrough, I'm not sure why that is being added to the list I copied from the command line

adduser/now 3.134 all [installed,local] apt-transport-https/now 2.6.1 all [installed,local] apt/now 2.6.1 amd64 [installed,local] autoconf/now 2.71-3 all [installed,local] automake/now 1:1.16.5-1.3 all [installed,local] autotools-dev/now 20220109.1 all [installed,local] base-files/now 12.4+deb12u1 amd64 [installed,local] base-passwd/now 3.6.1 amd64 [installed,local] bash/now 5.2.15-2+b2 amd64 [installed,local] bind9-dnsutils/now 1:9.18.19-1~deb12u1 amd64 [installed,local] bind9-host/now 1:9.18.19-1~deb12u1 amd64 [installed,local] bind9-libs/now 1:9.18.19-1~deb12u1 amd64 [installed,local] binutils-common/now 2.40-2 amd64 [installed,local] binutils-x86-64-linux-gnu/now 2.40-2 amd64 [installed,local] binutils/now 2.40-2 amd64 [installed,local] bison/now 2:3.8.2+dfsg-1+b1 amd64 [installed,local] bsdutils/now 1:2.38.1-5+b1 amd64 [installed,local] build-essential/now 12.9 amd64 [installed,local] bzip2/now 1.0.8-5+b1 amd64 [installed,local] ca-certificates/now 20230311 all [installed,local] comerr-dev/now 2.1-1.47.0-2 amd64 [installed,local] coreutils/now 9.1-1 amd64 [installed,local] cpp-12/now 12.2.0-14 amd64 [installed,local] cpp/now 4:12.2.0-3 amd64 [installed,local] curl/now 7.88.1-10+deb12u3 amd64 [installed,local] dash/now 0.5.12-2 amd64 [installed,local] dbus-bin/now 1.14.10-1~deb12u1 amd64 [installed,local] dbus-daemon/now 1.14.10-1~deb12u1 amd64 [installed,local] dbus-session-bus-common/now 1.14.10-1~deb12u1 all [installed,local] dbus-system-bus-common/now 1.14.10-1~deb12u1 all [installed,local] dbus-user-session/now 1.14.10-1~deb12u1 amd64 [installed,local] dbus/now 1.14.10-1~deb12u1 amd64 [installed,local] debconf/now 1.5.82 all [installed,local] debian-archive-keyring/now 2023.3 all [installed,local] debianutils/now 5.7-0.4 amd64 [installed,local] default-libmysqlclient-dev/now 1.1.0 amd64 [installed,local] diffutils/now 1:3.8-4 amd64 [installed,local] dirmngr/now 2.2.40-1.1 amd64 [installed,local] dmsetup/now 2:1.02.185-2 amd64 [installed,local] dnsutils/now 1:9.18.19-1~deb12u1 all [installed,local] dpkg-dev/now 1.21.22 all [installed,local] dpkg/now 1.21.22 amd64 [installed,local] e2fsprogs/now 1.47.0-2 amd64 [installed,local] file/now 1:5.44-3 amd64 [installed,local] findutils/now 4.9.0-4 amd64 [installed,local] fontconfig-config/now 2.14.1-4 amd64 [installed,local] fontconfig/now 2.14.1-4 amd64 [installed,local] fonts-dejavu-core/now 2.37-6 all [installed,local] g++-12/now 12.2.0-14 amd64 [installed,local] g++/now 4:12.2.0-3 amd64 [installed,local] gawk/now 1:5.2.1-2 amd64 [installed,local] gcc-12-base/now 12.2.0-14 amd64 [installed,local] gcc-12/now 12.2.0-14 amd64 [installed,local] gcc/now 4:12.2.0-3 amd64 [installed,local] gdb/now 13.1-3 amd64 [installed,local] gir1.2-freedesktop/now 1.74.0-3 amd64 [installed,local] gir1.2-gdkpixbuf-2.0/now 2.42.10+dfsg-1+b1 amd64 [installed,local] gir1.2-glib-2.0/now 1.74.0-3 amd64 [installed,local] gir1.2-rsvg-2.0/now 2.54.7+dfsg-1~deb12u1 amd64 [installed,local] git-man/now 1:2.39.2-1.1 all [installed,local] git/now 1:2.39.2-1.1 amd64 [installed,local] gnupg-l10n/now 2.2.40-1.1 all [installed,local] gnupg-utils/now 2.2.40-1.1 amd64 [installed,local] gnupg/now 2.2.40-1.1 all [installed,local] gpg-agent/now 2.2.40-1.1 amd64 [installed,local] gpg-wks-client/now 2.2.40-1.1 amd64 [installed,local] gpg-wks-server/now 2.2.40-1.1 amd64 [installed,local] gpg/now 2.2.40-1.1 amd64 [installed,local] gpgconf/now 2.2.40-1.1 amd64 [installed,local] gpgsm/now 2.2.40-1.1 amd64 [installed,local] gpgv/now 2.2.40-1.1 amd64 [installed,local] grep/now 3.8-5 amd64 [installed,local] gzip/now 1.12-1 amd64 [installed,local] hicolor-icon-theme/now 0.17-2 all [installed,local] hostname/now 3.23+nmu1 amd64 [installed,local] icu-devtools/now 72.1-3 amd64 [installed,local] imagemagick-6-common/now 8:6.9.11.60+dfsg-1.6 all [installed,local] imagemagick-6.q16/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] imagemagick/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] init-system-helpers/now 1.65.2 all [installed,local] krb5-multidev/now 1.20.1-2 amd64 [installed,local] lcov/now 1.16-1 all [installed,local] libacl1/now 2.3.1-3 amd64 [installed,local] libaom3/now 3.6.0-1 amd64 [installed,local] libapparmor1/now 3.0.8-3 amd64 [installed,local] libapr1/now 1.7.2-3 amd64 [installed,local] libaprutil1/now 1.6.3-1 amd64 [installed,local] libapt-pkg6.0/now 2.6.1 amd64 [installed,local] libargon2-0/now 0~20171227-0.3+deb12u1 amd64 [installed,local] libargon2-1/now 0~20171227-0.3+deb12u1 amd64 [installed,local] libasan8/now 12.2.0-14 amd64 [installed,local] libassuan0/now 2.5.5-5 amd64 [installed,local] libatomic1/now 12.2.0-14 amd64 [installed,local] libattr1/now 1:2.5.1-4 amd64 [installed,local] libaudit-common/now 1:3.0.9-1 all [installed,local] libaudit1/now 1:3.0.9-1 amd64 [installed,local] libbabeltrace1/now 1.5.11-1+b2 amd64 [installed,local] libbinutils/now 2.40-2 amd64 [installed,local] libblkid-dev/now 2.38.1-5+b1 amd64 [installed,local] libblkid1/now 2.38.1-5+b1 amd64 [installed,local] libboost-regex1.74.0/now 1.74.0+ds1-21 amd64 [installed,local] libbrotli-dev/now 1.0.9-2+b6 amd64 [installed,local] libbrotli1/now 1.0.9-2+b6 amd64 [installed,local] libbsd0/now 0.11.7-2 amd64 [installed,local] libbz2-1.0/now 1.0.8-5+b1 amd64 [installed,local] libbz2-dev/now 1.0.8-5+b1 amd64 [installed,local] libc-bin/now 2.36-9+deb12u3 amd64 [installed,local] libc-dev-bin/now 2.36-9+deb12u3 amd64 [installed,local] libc6-dev/now 2.36-9+deb12u3 amd64 [installed,local] libc6/now 2.36-9+deb12u3 amd64 [installed,local] libcairo-gobject2/now 1.16.0-7 amd64 [installed,local] libcairo-script-interpreter2/now 1.16.0-7 amd64 [installed,local] libcairo2-dev/now 1.16.0-7 amd64 [installed,local] libcairo2/now 1.16.0-7 amd64 [installed,local] libcap-ng0/now 0.8.3-1+b3 amd64 [installed,local] libcap2/now 1:2.66-4 amd64 [installed,local] libcbor0.8/now 0.8.0-2+b1 amd64 [installed,local] libcc1-0/now 12.2.0-14 amd64 [installed,local] libcom-err2/now 1.47.0-2 amd64 [installed,local] libcrypt-dev/now 1:4.4.33-2 amd64 [installed,local] libcrypt1/now 1:4.4.33-2 amd64 [installed,local] libcryptsetup12/now 2:2.6.1-4~deb12u1 amd64 [installed,local] libctf-nobfd0/now 2.40-2 amd64 [installed,local] libctf0/now 2.40-2 amd64 [installed,local] libcurl3-gnutls/now 7.88.1-10+deb12u3 amd64 [installed,local] libcurl4-openssl-dev/now 7.88.1-10+deb12u3 amd64 [installed,local] libcurl4/now 7.88.1-10+deb12u3 amd64 [installed,local] libdatrie1/now 0.2.13-2+b1 amd64 [installed,local] libdav1d6/now 1.0.0-2 amd64 [installed,local] libdb-dev/now 5.3.2 amd64 [installed,local] libdb5.3-dev/now 5.3.28+dfsg2-1 amd64 [installed,local] libdb5.3/now 5.3.28+dfsg2-1 amd64 [installed,local] libdbus-1-3/now 1.14.10-1~deb12u1 amd64 [installed,local] libde265-0/now 1.0.11-1 amd64 [installed,local] libdebconfclient0/now 0.270 amd64 [installed,local] libdebuginfod-common/now 0.188-2.1 all [installed,local] libdebuginfod1/now 0.188-2.1 amd64 [installed,local] libdeflate-dev/now 1.14-1 amd64 [installed,local] libdeflate0/now 1.14-1 amd64 [installed,local] libdevmapper1.02.1/now 2:1.02.185-2 amd64 [installed,local] libdjvulibre-dev/now 3.5.28-2+b1 amd64 [installed,local] libdjvulibre-text/now 3.5.28-2 all [installed,local] libdjvulibre21/now 3.5.28-2+b1 amd64 [installed,local] libdpkg-perl/now 1.21.22 all [installed,local] libdw1/now 0.188-2.1 amd64 [installed,local] libedit2/now 3.1-20221030-2 amd64 [installed,local] libelf1/now 0.188-2.1 amd64 [installed,local] liberror-perl/now 0.17029-2 all [installed,local] libevent-2.1-7/now 2.1.12-stable-8 amd64 [installed,local] libevent-core-2.1-7/now 2.1.12-stable-8 amd64 [installed,local] libevent-dev/now 2.1.12-stable-8 amd64 [installed,local] libevent-extra-2.1-7/now 2.1.12-stable-8 amd64 [installed,local] libevent-openssl-2.1-7/now 2.1.12-stable-8 amd64 [installed,local] libevent-pthreads-2.1-7/now 2.1.12-stable-8 amd64 [installed,local] libexif-dev/now 0.6.24-1+b1 amd64 [installed,local] libexif12/now 0.6.24-1+b1 amd64 [installed,local] libexpat1-dev/now 2.5.0-1 amd64 [installed,local] libexpat1/now 2.5.0-1 amd64 [installed,local] libext2fs2/now 1.47.0-2 amd64 [installed,local] libfdisk1/now 2.38.1-5+b1 amd64 [installed,local] libffi-dev/now 3.4.4-1 amd64 [installed,local] libffi8/now 3.4.4-1 amd64 [installed,local] libfftw3-double3/now 3.3.10-1 amd64 [installed,local] libfido2-1/now 1.12.0-2+b1 amd64 [installed,local] libfontconfig-dev/now 2.14.1-4 amd64 [installed,local] libfontconfig1/now 2.14.1-4 amd64 [installed,local] libfreetype-dev/now 2.12.1+dfsg-5 amd64 [installed,local] libfreetype6-dev/now 2.12.1+dfsg-5 amd64 [installed,local] libfreetype6/now 2.12.1+dfsg-5 amd64 [installed,local] libfribidi0/now 1.0.8-2.1 amd64 [installed,local] libfstrm0/now 0.6.1-1 amd64 [installed,local] libgcc-12-dev/now 12.2.0-14 amd64 [installed,local] libgcc-s1/now 12.2.0-14 amd64 [installed,local] libgcrypt20/now 1.10.1-3 amd64 [installed,local] libgdbm-compat4/now 1.23-3 amd64 [installed,local] libgdbm-dev/now 1.23-3 amd64 [installed,local] libgdbm6/now 1.23-3 amd64 [installed,local] libgdiplus/now 6.1+dfsg-1+b1 amd64 [installed,local] libgdk-pixbuf-2.0-0/now 2.42.10+dfsg-1+b1 amd64 [installed,local] libgdk-pixbuf-2.0-dev/now 2.42.10+dfsg-1+b1 amd64 [installed,local] libgdk-pixbuf2.0-bin/now 2.42.10+dfsg-1+b1 amd64 [installed,local] libgdk-pixbuf2.0-common/now 2.42.10+dfsg-1 all [installed,local] libgif7/now 5.2.1-2.5 amd64 [installed,local] libgirepository-1.0-1/now 1.74.0-3 amd64 [installed,local] libglib2.0-0/now 2.74.6-2 amd64 [installed,local] libglib2.0-bin/now 2.74.6-2 amd64 [installed,local] libglib2.0-data/now 2.74.6-2 all [installed,local] libglib2.0-dev-bin/now 2.74.6-2 amd64 [installed,local] libglib2.0-dev/now 2.74.6-2 amd64 [installed,local] libgmp-dev/now 2:6.2.1+dfsg1-1.1 amd64 [installed,local] libgmp10/now 2:6.2.1+dfsg1-1.1 amd64 [installed,local] libgmpxx4ldbl/now 2:6.2.1+dfsg1-1.1 amd64 [installed,local] libgnutls30/now 3.7.9-2 amd64 [installed,local] libgomp1/now 12.2.0-14 amd64 [installed,local] libgpg-error0/now 1.46-1 amd64 [installed,local] libgpm2/now 1.20.7-10+b1 amd64 [installed,local] libgprofng0/now 2.40-2 amd64 [installed,local] libgraphite2-3/now 1.3.14-1 amd64 [installed,local] libgssapi-krb5-2/now 1.20.1-2 amd64 [installed,local] libgssrpc4/now 1.20.1-2 amd64 [installed,local] libharfbuzz0b/now 6.0.0+dfsg-3 amd64 [installed,local] libheif1/now 1.15.1-1 amd64 [installed,local] libhogweed6/now 3.8.1-2 amd64 [installed,local] libice-dev/now 2:1.0.10-1 amd64 [installed,local] libice6/now 2:1.0.10-1 amd64 [installed,local] libicu-dev/now 72.1-3 amd64 [installed,local] libicu72/now 72.1-3 amd64 [installed,local] libidn2-0/now 2.3.3-1+b1 amd64 [installed,local] libimath-3-1-29/now 3.1.6-1 amd64 [installed,local] libimath-dev/now 3.1.6-1 amd64 [installed,local] libio-pty-perl/now 1:1.17-1 amd64 [installed,local] libip4tc2/now 1.8.9-2 amd64 [installed,local] libipc-run-perl/now 20220807.0-1 all [installed,local] libipt2/now 2.0.5-1 amd64 [installed,local] libisl23/now 0.25-1 amd64 [installed,local] libitm1/now 12.2.0-14 amd64 [installed,local] libjansson4/now 2.14-2 amd64 [installed,local] libjbig-dev/now 2.1-6.1 amd64 [installed,local] libjbig0/now 2.1-6.1 amd64 [installed,local] libjemalloc2/now 5.3.0-1 amd64 [installed,local] libjpeg-dev/now 1:2.1.5-2 amd64 [installed,local] libjpeg62-turbo-dev/now 1:2.1.5-2 amd64 [installed,local] libjpeg62-turbo/now 1:2.1.5-2 amd64 [installed,local] libjs-jquery/now 3.6.1+dfsg+~3.5.14-1 all [installed,local] libjs-sphinxdoc/now 5.3.0-4 all [installed,local] libjs-underscore/now 1.13.4~dfsg+~1.11.4-3 all [installed,local] libjson-c5/now 0.16-2 amd64 [installed,local] libjson-perl/now 4.10000-1 all [installed,local] libk5crypto3/now 1.20.1-2 amd64 [installed,local] libkadm5clnt-mit12/now 1.20.1-2 amd64 [installed,local] libkadm5srv-mit12/now 1.20.1-2 amd64 [installed,local] libkdb5-10/now 1.20.1-2 amd64 [installed,local] libkeyutils1/now 1.6.3-2 amd64 [installed,local] libkmod2/now 30+20221128-1 amd64 [installed,local] libkrb5-3/now 1.20.1-2 amd64 [installed,local] libkrb5-dev/now 1.20.1-2 amd64 [installed,local] libkrb5support0/now 1.20.1-2 amd64 [installed,local] libksba8/now 1.6.3-2 amd64 [installed,local] liblcms2-2/now 2.14-2 amd64 [installed,local] liblcms2-dev/now 2.14-2 amd64 [installed,local] libldap-2.5-0/now 2.5.13+dfsg-5 amd64 [installed,local] liblerc-dev/now 4.0.0+ds-2 amd64 [installed,local] liblerc4/now 4.0.0+ds-2 amd64 [installed,local] liblmdb0/now 0.9.24-1 amd64 [installed,local] liblqr-1-0-dev/now 0.4.2-2.1 amd64 [installed,local] liblqr-1-0/now 0.4.2-2.1 amd64 [installed,local] liblsan0/now 12.2.0-14 amd64 [installed,local] libltdl-dev/now 2.4.7-5 amd64 [installed,local] libltdl7/now 2.4.7-5 amd64 [installed,local] liblz4-1/now 1.9.4-1 amd64 [installed,local] liblzma-dev/now 5.4.1-0.2 amd64 [installed,local] liblzma5/now 5.4.1-0.2 amd64 [installed,local] liblzo2-2/now 2.10-2 amd64 [installed,local] libmagic-mgc/now 1:5.44-3 amd64 [installed,local] libmagic1/now 1:5.44-3 amd64 [installed,local] libmagickcore-6-arch-config/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] libmagickcore-6-headers/now 8:6.9.11.60+dfsg-1.6 all [installed,local] libmagickcore-6.q16-6-extra/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] libmagickcore-6.q16-6/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] libmagickcore-6.q16-dev/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] libmagickcore-dev/now 8:6.9.11.60+dfsg-1.6 all [installed,local] libmagickwand-6-headers/now 8:6.9.11.60+dfsg-1.6 all [installed,local] libmagickwand-6.q16-6/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] libmagickwand-6.q16-dev/now 8:6.9.11.60+dfsg-1.6 amd64 [installed,local] libmagickwand-dev/now 8:6.9.11.60+dfsg-1.6 all [installed,local] libmariadb-dev-compat/now 1:10.11.3-1 amd64 [installed,local] libmariadb-dev/now 1:10.11.3-1 amd64 [installed,local] libmariadb3/now 1:10.11.3-1 amd64 [installed,local] libmaxminddb-dev/now 1.7.1-1 amd64 [installed,local] libmaxminddb0/now 1.7.1-1 amd64 [installed,local] libmd0/now 1.0.4-2 amd64 [installed,local] libmount-dev/now 2.38.1-5+b1 amd64 [installed,local] libmount1/now 2.38.1-5+b1 amd64 [installed,local] libmpc3/now 1.3.1-1 amd64 [installed,local] libmpfr6/now 4.2.0-1 amd64 [installed,local] libncurses-dev/now 6.4-4 amd64 [installed,local] libncurses5-dev/now 6.4-4 amd64 [installed,local] libncurses5/now 6.4-4 amd64 [installed,local] libncurses6/now 6.4-4 amd64 [installed,local] libncursesw5-dev/now 6.4-4 amd64 [installed,local] libncursesw6/now 6.4-4 amd64 [installed,local] libnet1/now 1.1.6+dfsg-3.2 amd64 [installed,local] libnettle8/now 3.8.1-2 amd64 [installed,local] libnghttp2-14/now 1.52.0-1 amd64 [installed,local] libnpth0/now 1.6-3 amd64 [installed,local] libnsl-dev/now 1.3.0-2 amd64 [installed,local] libnsl2/now 1.3.0-2 amd64 [installed,local] libnss-systemd/now 252.17-1~deb12u1 amd64 [installed,local] libnuma1/now 2.0.16-1 amd64 [installed,local] libodbc2/now 2.3.11-2+deb12u1 amd64 [installed,local] libodbccr2/now 2.3.11-2+deb12u1 amd64 [installed,local] libodbcinst2/now 2.3.11-2+deb12u1 amd64 [installed,local] libonig-dev/now 6.9.8-1 amd64 [installed,local] libonig5/now 6.9.8-1 amd64 [installed,local] libopenexr-3-1-30/now 3.1.5-5 amd64 [installed,local] libopenexr-dev/now 3.1.5-5 amd64 [installed,local] libopenjp2-7-dev/now 2.5.0-2 amd64 [installed,local] libopenjp2-7/now 2.5.0-2 amd64 [installed,local] libp11-kit0/now 0.24.1-2 amd64 [installed,local] libpam-modules-bin/now 1.5.2-6 amd64 [installed,local] libpam-modules/now 1.5.2-6 amd64 [installed,local] libpam-runtime/now 1.5.2-6 all [installed,local] libpam-systemd/now 252.17-1~deb12u1 amd64 [installed,local] libpam0g/now 1.5.2-6 amd64 [installed,local] libpango-1.0-0/now 1.50.12+ds-1 amd64 [installed,local] libpangocairo-1.0-0/now 1.50.12+ds-1 amd64 [installed,local] libpangoft2-1.0-0/now 1.50.12+ds-1 amd64 [installed,local] libpcap0.8/now 1.10.3-1 amd64 [installed,local] libpcre2-16-0/now 10.42-1 amd64 [installed,local] libpcre2-32-0/now 10.42-1 amd64 [installed,local] libpcre2-8-0/now 10.42-1 amd64 [installed,local] libpcre2-dev/now 10.42-1 amd64 [installed,local] libpcre2-posix3/now 10.42-1 amd64 [installed,local] libperl5.36/now 5.36.0-7 amd64 [installed,local] libperlio-gzip-perl/now 0.20-1+b1 amd64 [installed,local] libpixman-1-0/now 0.42.2-1 amd64 [installed,local] libpixman-1-dev/now 0.42.2-1 amd64 [installed,local] libpkgconf3/now 1.8.1-1 amd64 [installed,local] libpng-dev/now 1.6.39-2 amd64 [installed,local] libpng16-16/now 1.6.39-2 amd64 [installed,local] libpopt0/now 1.19+dfsg-1 amd64 [installed,local] libpq-dev/now 15.3-0+deb12u1 amd64 [installed,local] libpq5/now 15.3-0+deb12u1 amd64 [installed,local] libproc2-0/now 2:4.0.2-3 amd64 [installed,local] libprotobuf-c1/now 1.4.1-1+b1 amd64 [installed,local] libpsl5/now 0.21.2-1 amd64 [installed,local] libpthread-stubs0-dev/now 0.4-1 amd64 [installed,local] libpython3-dev/now 3.11.2-1+b1 amd64 [installed,local] libpython3-stdlib/now 3.11.2-1+b1 amd64 [installed,local] libpython3.11-dev/now 3.11.2-6 amd64 [installed,local] libpython3.11-minimal/now 3.11.2-6 amd64 [installed,local] libpython3.11-stdlib/now 3.11.2-6 amd64 [installed,local] libpython3.11/now 3.11.2-6 amd64 [installed,local] libquadmath0/now 12.2.0-14 amd64 [installed,local] libreadline-dev/now 8.2-1.3 amd64 [installed,local] libreadline8/now 8.2-1.3 amd64 [installed,local] librsvg2-2/now 2.54.7+dfsg-1~deb12u1 amd64 [installed,local] librsvg2-common/now 2.54.7+dfsg-1~deb12u1 amd64 [installed,local] librsvg2-dev/now 2.54.7+dfsg-1~deb12u1 amd64 [installed,local] librtmp1/now 2.4+20151223.gitfa8646d.1-2+b2 amd64 [installed,local] libsasl2-2/now 2.1.28+dfsg-10 amd64 [installed,local] libsasl2-modules-db/now 2.1.28+dfsg-10 amd64 [installed,local] libseccomp2/now 2.5.4-1+b3 amd64 [installed,local] libselinux1-dev/now 3.4-1+b6 amd64 [installed,local] libselinux1/now 3.4-1+b6 amd64 [installed,local] libsemanage-common/now 3.4-1 all [installed,local] libsemanage2/now 3.4-1+b5 amd64 [installed,local] libsepol-dev/now 3.4-2.1 amd64 [installed,local] libsepol2/now 3.4-2.1 amd64 [installed,local] libserf-1-1/now 1.3.9-11 amd64 [installed,local] libsigsegv2/now 2.14-1 amd64 [installed,local] libsm-dev/now 2:1.2.3-1 amd64 [installed,local] libsm6/now 2:1.2.3-1 amd64 [installed,local] libsmartcols1/now 2.38.1-5+b1 amd64 [installed,local] libsodium-dev/now 1.0.18-1 amd64 [installed,local] libsodium23/now 1.0.18-1 amd64 [installed,local] libsource-highlight-common/now 3.1.9-4.2 all [installed,local] libsource-highlight4v5/now 3.1.9-4.2+b3 amd64 [installed,local] libsqlite3-0/now 3.40.1-2 amd64 [installed,local] libsqlite3-dev/now 3.40.1-2 amd64 [installed,local] libss2/now 1.47.0-2 amd64 [installed,local] libssh2-1/now 1.10.0-3+b1 amd64 [installed,local] libssl-dev/now 3.0.11-1~deb12u1 amd64 [installed,local] libssl3/now 3.0.11-1~deb12u1 amd64 [installed,local] libstdc++-12-dev/now 12.2.0-14 amd64 [installed,local] libstdc++6/now 12.2.0-14 amd64 [installed,local] libsvn1/now 1.14.2-4+b2 amd64 [installed,local] libsystemd-shared/now 252.17-1~deb12u1 amd64 [installed,local] libsystemd0/now 252.17-1~deb12u1 amd64 [installed,local] libtasn1-6/now 4.19.0-2 amd64 [installed,local] libtcl8.6/now 8.6.13+dfsg-2 amd64 [installed,local] libthai-data/now 0.1.29-1 all [installed,local] libthai0/now 0.1.29-1 amd64 [installed,local] libtiff-dev/now 4.5.0-6 amd64 [installed,local] libtiff6/now 4.5.0-6 amd64 [installed,local] libtiffxx6/now 4.5.0-6 amd64 [installed,local] libtime-duration-perl/now 1.21-2 all [installed,local] libtimedate-perl/now 2.3300-2 all [installed,local] libtinfo5/now 6.4-4 amd64 [installed,local] libtinfo6/now 6.4-4 amd64 [installed,local] libtirpc-common/now 1.3.3+ds-1 all [installed,local] libtirpc-dev/now 1.3.3+ds-1 amd64 [installed,local] libtirpc3/now 1.3.3+ds-1 amd64 [installed,local] libtk8.6/now 8.6.13-2 amd64 [installed,local] libtool/now 2.4.7-5 all [installed,local] libtsan2/now 12.2.0-14 amd64 [installed,local] libubsan1/now 12.2.0-14 amd64 [installed,local] libudev1/now 252.17-1~deb12u1 amd64 [installed,local] libunistring2/now 1.0-2 amd64 [installed,local] libunwind8/now 1.6.2-3 amd64 [installed,local] libutf8proc2/now 2.8.0-1 amd64 [installed,local] libuuid1/now 2.38.1-5+b1 amd64 [installed,local] libuv1/now 1.44.2-1 amd64 [installed,local] libwebp-dev/now 1.2.4-0.2 amd64 [installed,local] libwebp7/now 1.2.4-0.2 amd64 [installed,local] libwebpdemux2/now 1.2.4-0.2 amd64 [installed,local] libwebpmux3/now 1.2.4-0.2 amd64 [installed,local] libwmf-0.2-7/now 0.2.12-5.1 amd64 [installed,local] libwmf-dev/now 0.2.12-5.1 amd64 [installed,local] libwmflite-0.2-7/now 0.2.12-5.1 amd64 [installed,local] libwrap0/now 7.6.q-32 amd64 [installed,local] libx11-6/now 2:1.8.4-2+deb12u1 amd64 [installed,local] libx11-data/now 2:1.8.4-2+deb12u1 all [installed,local] libx11-dev/now 2:1.8.4-2+deb12u1 amd64 [installed,local] libx265-199/now 3.5-2+b1 amd64 [installed,local] libxau-dev/now 1:1.0.9-1 amd64 [installed,local] libxau6/now 1:1.0.9-1 amd64 [installed,local] libxcb-render0-dev/now 1.15-1 amd64 [installed,local] libxcb-render0/now 1.15-1 amd64 [installed,local] libxcb-shm0-dev/now 1.15-1 amd64 [installed,local] libxcb-shm0/now 1.15-1 amd64 [installed,local] libxcb1-dev/now 1.15-1 amd64 [installed,local] libxcb1/now 1.15-1 amd64 [installed,local] libxdmcp-dev/now 1:1.1.2-3 amd64 [installed,local] libxdmcp6/now 1:1.1.2-3 amd64 [installed,local] libxext-dev/now 2:1.3.4-1+b1 amd64 [installed,local] libxext6/now 2:1.3.4-1+b1 amd64 [installed,local] libxft-dev/now 2.3.6-1 amd64 [installed,local] libxft2/now 2.3.6-1 amd64 [installed,local] libxml2-dev/now 2.9.14+dfsg-1.3~deb12u1 amd64 [installed,local] libxml2/now 2.9.14+dfsg-1.3~deb12u1 amd64 [installed,local] libxmuu1/now 2:1.1.3-3 amd64 [installed,local] libxrender-dev/now 1:0.9.10-1.1 amd64 [installed,local] libxrender1/now 1:0.9.10-1.1 amd64 [installed,local] libxslt1-dev/now 1.1.35-1 amd64 [installed,local] libxslt1.1/now 1.1.35-1 amd64 [installed,local] libxss-dev/now 1:1.2.3-1 amd64 [installed,local] libxss1/now 1:1.2.3-1 amd64 [installed,local] libxt-dev/now 1:1.2.1-1.1 amd64 [installed,local] libxt6/now 1:1.2.1-1.1 amd64 [installed,local] libxxhash0/now 0.8.1-1 amd64 [installed,local] libyaml-0-2/now 0.2.5-1 amd64 [installed,local] libyaml-dev/now 0.2.5-1 amd64 [installed,local] libzstd-dev/now 1.5.4+dfsg2-5 amd64 [installed,local] libzstd1/now 1.5.4+dfsg2-5 amd64 [installed,local] linux-libc-dev/now 6.1.38-4 amd64 [installed,local] login/now 1:4.13+dfsg1-1+b1 amd64 [installed,local] logsave/now 1.47.0-2 amd64 [installed,local] lzma-dev/now 9.22-2.2 all [installed,local] lzma/now 9.22-2.2 amd64 [installed,local] m4/now 1.4.19-3 amd64 [installed,local] make/now 4.3-4.1 amd64 [installed,local] mariadb-common/now 1:10.11.3-1 all [installed,local] mawk/now 1.3.4.20200120-3.1 amd64 [installed,local] media-types/now 10.0.0 all [installed,local] mercurial-common/now 6.3.2-1 all [installed,local] mercurial/now 6.3.2-1 amd64 [installed,local] moreutils/now 0.67-1 amd64 [installed,local] mount/now 2.38.1-5+b1 amd64 [installed,local] mysql-common/now 5.8+1.1.0 all [installed,local] ncurses-base/now 6.4-4 all [installed,local] ncurses-bin/now 6.4-4 amd64 [installed,local] ncurses-term/now 6.4-4 all [installed,local] netbase/now 6.4 all [installed,local] openssh-client/now 1:9.2p1-2+deb12u1 amd64 [installed,local] openssh-server/now 1:9.2p1-2+deb12u1 amd64 [installed,local] openssh-sftp-server/now 1:9.2p1-2+deb12u1 amd64 [installed,local] openssl/now 3.0.11-1~deb12u1 amd64 [installed,local] packages-microsoft-prod/now 1.0-ubuntu18.04.2 all [installed,local] passwd/now 1:4.13+dfsg1-1+b1 amd64 [installed,local] patch/now 2.7.6-7 amd64 [installed,local] perl-base/now 5.36.0-7 amd64 [installed,local] perl-modules-5.36/now 5.36.0-7 all [installed,local] perl/now 5.36.0-7 amd64 [installed,local] pinentry-curses/now 1.2.1-1 amd64 [installed,local] pkg-config/now 1.8.1-1 amd64 [installed,local] pkgconf-bin/now 1.8.1-1 amd64 [installed,local] pkgconf/now 1.8.1-1 amd64 [installed,local] procps/now 2:4.0.2-3 amd64 [installed,local] python3-dev/now 3.11.2-1+b1 amd64 [installed,local] python3-distutils/now 3.11.2-3 all [installed,local] python3-lib2to3/now 3.11.2-3 all [installed,local] python3-minimal/now 3.11.2-1+b1 amd64 [installed,local] python3.11-dev/now 3.11.2-6 amd64 [installed,local] python3.11-minimal/now 3.11.2-6 amd64 [installed,local] python3.11/now 3.11.2-6 amd64 [installed,local] python3/now 3.11.2-1+b1 amd64 [installed,local] readline-common/now 8.2-1.3 all [installed,local] rpcsvc-proto/now 1.4.3-1 amd64 [installed,local] rsync/now 3.2.7-1 amd64 [installed,local] runit-helper/now 2.15.2 all [installed,local] sed/now 4.9-1 amd64 [installed,local] sensible-utils/now 0.0.17+nmu1 all [installed,local] sgml-base/now 1.31 all [installed,local] shared-mime-info/now 2.2-1 amd64 [installed,local] sq/now 0.27.0-2+b1 amd64 [installed,local] sqlite3/now 3.40.1-2 amd64 [installed,local] squashfs-tools/now 1:4.5.1-1 amd64 [installed,local] ssh/now 1:9.2p1-2+deb12u1 all [installed,local] subversion/now 1.14.2-4+b2 amd64 [installed,local] systemd-sysv/now 252.17-1~deb12u1 amd64 [installed,local] systemd-timesyncd/now 252.17-1~deb12u1 amd64 [installed,local] systemd/now 252.17-1~deb12u1 amd64 [installed,local] sysvinit-utils/now 3.06-4 amd64 [installed,local] tar/now 1.34+dfsg-1.2 amd64 [installed,local] tcl-dev/now 8.6.13 amd64 [installed,local] tcl8.6-dev/now 8.6.13+dfsg-2 amd64 [installed,local] tcl8.6/now 8.6.13+dfsg-2 amd64 [installed,local] tcl/now 8.6.13 amd64 [installed,local] tcptraceroute/now 1.5beta7+debian-4.1+b1 amd64 [installed,local] tk-dev/now 8.6.13 amd64 [installed,local] tk8.6-dev/now 8.6.13-2 amd64 [installed,local] tk8.6/now 8.6.13-2 amd64 [installed,local] tk/now 8.6.13 amd64 [installed,local] traceroute/now 1:2.1.2-1 amd64 [installed,local] tree/now 2.1.0-1 amd64 [installed,local] tzdata/now 2023c-5 all [installed,local] ucf/now 3.0043+nmu1 all [installed,local] unixodbc-common/now 2.3.11-2+deb12u1 all [installed,local] unixodbc-dev/now 2.3.11-2+deb12u1 amd64 [installed,local] unzip/now 6.0-28 amd64 [installed,local] usr-is-merged/now 35 all [installed,local] util-linux-extra/now 2.38.1-5+b1 amd64 [installed,local] util-linux/now 2.38.1-5+b1 amd64 [installed,local] uuid-dev/now 2.38.1-5+b1 amd64 [installed,local] vim-common/now 2:9.0.1378-2 all [installed,local] vim-runtime/now 2:9.0.1378-2 all [installed,local] vim/now 2:9.0.1378-2 amd64 [installed,local] wget/now 1.21.3-1+b2 amd64 [installed,local] x11-common/now 1:7.7+23 all [installed,local] x11proto-core-dev/now 2022.1-1 all [installed,local] x11proto-dev/now 2022.1-1 all [installed,local] xauth/now 1:1.1.2-1 amd64 [installed,local] xorg-sgml-doctools/now 1:1.11-1.1 all [installed,local] xtrans-dev/now 1.4.0-1 all [installed,local] xz-utils/now 5.4.1-0.2 amd64 [installed,local] zip/now 3.0-13 amd64 [installed,local] zlib1g-dev/now 1:1.2.13.dfsg-1 amd64 [installed,local] zlib1g/now 1:1.2.13.dfsg-1 amd64 [installed,local]

HakanL commented 11 months ago

Did you try the native wkhtmltopdf command line tool in this container/instance?

nydsteven commented 11 months ago

No, just the NuGet package published with my app to the app service. Thanks for your help, could you tell me where the command line tool info is? Sorry I didn't see it on the readme

HakanL commented 11 months ago

So this project is just a .NET wrapper around a native library. So when you're getting these exceptions it's most likely because the OS fails to load the native library (due to missing dependencies). Unfortunately native dependencies are a lot harder to troubleshoot than .NET, but that's the issue with using native libraries (there are no managed opensource HTML to PDF libraries available). A way to start the troubleshooting is to get the native library to work, then it should be easier to get this project to work. https://wkhtmltopdf.org/downloads.html

nydsteven commented 11 months ago

I see, that makes sense - thanks a ton for your help. I believe I used the native library in the past, if you happen to remember, is that where the extra dlls need to be deployed separately for it to work?

HakanL commented 11 months ago

There shouldn't be any extra DLLs needed, but there are primarily two things in play for the library to be loaded by .NET runtime. a) Find the native library (.NET has hard-coded search paths, like runtimes/native/win-xxx, etc) b) The OS tried to load all the dependencies for that native library (like libssl, libjpeg, of the exact version, libjpeg62, etc) If either of those fails then .NET (this project) only gets an error back saying "Failed to load".

So the OS has to have the exact native dependencies installed or it won't work. Some people "cheat" by installing a package (apt-get, etc) for the wkhtmltopdf, which will then pull in the native dependencies), but it's not required, you can just make sure the correct libraries are installed.

Your upgrade to .NET8 probably changed the installed native libraries (perhaps libssl) and that broke the wkhtmltopdf library.

nydsteven commented 11 months ago

Gotcha, thanks again for all of the info! I'll post back here if I can get it running/deployed on .NET 8

asaray11 commented 11 months ago

I am able to run it in .NET8 containers with the following lines in dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

RUN apt-get update && ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so RUN apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

But I am not happy for using libssl1.1 since it has vulnerabilities and caught as vulnerable by trivy container scanner, trying to find a solution.

wapenshaw commented 11 months ago

Gotcha, thanks again for all of the info! I'll post back here if I can get it running/deployed on .NET 8

@nydsteven Hi, I am having the same issue, deploying dotnet8 app to azure linux webapp. dotnet 7 was working fine. Were you able to resolve the issue? Everything about the app is same except updated packages and changed runtime to DOTNET 8 image

nydsteven commented 11 months ago

@wapenshaw I still haven't found a workaround for an App Service that's not using Docker on Linux. But it seems like the libssl1.1 that @asaray11 mentioned is the issue, I've been working on compiling another binary that references libssl3 form linux-64 but haven't had any luck yet

luarfaria commented 11 months ago

I am able to run it in .NET8 containers with the following lines in dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

RUN apt-get update && ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so RUN apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

But I am not happy for using libssl1.1 since it has vulnerabilities and caught as vulnerable by trivy container scanner, trying to find a solution.

This solution worked for me running on dotnet 7

PaulIvanov commented 10 months ago

I ran into this issue today as well. Looks like a dependency change from .net 6 to .net 8 causes this lib to break on non-docker linux based azure app services. @nydsteven out of curiosity, have you made any more progress on finding a workaround?

PaulIvanov commented 10 months ago

I was able to find a solution inspired by the docker solution above that @asaray11 posted. In the case of a non-docker linux azure app service container, I was able to modify the startup.sh file in the container via the KUDU advanced toolset.

Heres a brief article on how to modify the startup.sh so that it persists between deployments: https://azureossd.github.io/2020/01/23/custom-startup-for-nodejs-python/index.html

In the startup.sh file I added in the following content BEFORE it runs the project .dll:

apt-get update && ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so
apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb
ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

I dont love this solution as it requires custom configuration in a hard to customize container, so I can see this solution breaking with little to no recourse if Azure App Service decides that this is not ok. If someone else finds a better solution, I'd love to hear about it.

PoomBE commented 9 months ago

ฉันสามารถเรียกใช้มัน .ภาชนะบรรจุ NET8 ที่มีบรรทัดต่อไปนี้ใน dockerfile:

จาก mcr.microsoft.com/dotnet/aspnet: 8.0 AS base

RUN apt-get update && ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so RUN apt-get install -y - ไม่มีการติดตั้งแนะนํา zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi RUN Wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb RUN Wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

แต่ฉันไม่มีความสุขกับการใช้ libssl1.1 เนื่องจากมีช่องโหว่และถูกจับได้ว่ามีความเสี่ยงจากเครื่องสแกนคอนเทนเนอร์ขนาดเล็กพยายามหาวิธีแก้ปัญหา.

I use and Terminal is Error how to Fix? 1.938 ln: failed to create symbolic link '/lib/x86_64-linux-gnu/libgdiplus.so': No such file or directory

My Project is FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base I use MAC os

intracodenl commented 8 months ago

I was able to find a solution inspired by the docker solution above that @asaray11 posted. In the case of a non-docker linux azure app service container, I was able to modify the startup.sh file in the container via the KUDU advanced toolset.

Heres a brief article on how to modify the startup.sh so that it persists between deployments: https://azureossd.github.io/2020/01/23/custom-startup-for-nodejs-python/index.html

In the startup.sh file I added in the following content BEFORE it runs the project .dll:

apt-get update && ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so
apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb
ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

I dont love this solution as it requires custom configuration in a hard to customize container, so I can see this solution breaking with little to no recourse if Azure App Service decides that this is not ok. If someone else finds a better solution, I'd love to hear about it.

I can confirm that this solution works for now, thx Paul!

colbroth commented 7 months ago

I was having this issue when updating from .net 6 to .net 8. Since this nuget was a branch off of DinkToPdf, I tried the DinkToPdf nuget version 1.0.8 instead and was able to run the application on a Linux agent using .net 8. I am using the standard azure linux agent for .net 8. I downloaded the libwkhtmlox.dll, libwkhtmltox.dlib, and libwkhtmltox.so libraries. Then added this to my .csproj to copy these over.

<ItemGroup>
  <!-- These libraries were copied from DinkToPdf nuget version 1.0.8 folder v0.12.4\64 bit.  -->
  <None Update="libwkhtmltox.dll">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="libwkhtmltox.dylib">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="libwkhtmltox.so">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
   </None>
</ItemGroup>
dramatard commented 6 months ago

I was having this issue when updating from .net 6 to .net 8. Since this nuget was a branch off of DinkToPdf, I tried the DinkToPdf nuget version 1.0.8 instead and was able to run the application on a Linux agent using .net 8.

Are you using the standard dotnet azure app service images or did you roll out a custom dockerfile/image?

colbroth commented 6 months ago

I was having this issue when updating from .net 6 to .net 8. Since this nuget was a branch off of DinkToPdf, I tried the DinkToPdf nuget version 1.0.8 instead and was able to run the application on a Linux agent using .net 8.

Are you using the standard dotnet azure app service images or did you roll out a custom dockerfile/image?

I updated my original post with the steps I did.

GPA216 commented 6 months ago

I am also facing this same error when migrating to .Net 8.0. Is there anyone found any Solution?

markandrewkato commented 5 months ago

I am able to run it in .NET8 containers with the following lines in dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

RUN apt-get update && ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so RUN apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb RUN gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

But I am not happy for using libssl1.1 since it has vulnerabilities and caught as vulnerable by trivy container scanner, trying to find a solution.

Took me a long time but with some adjustments, I had this work on the sdk 8.0. Thanks!

intracodenl commented 5 months ago

I was having this issue when updating from .net 6 to .net 8. Since this nuget was a branch off of DinkToPdf, I tried the DinkToPdf nuget version 1.0.8 instead and was able to run the application on a Linux agent using .net 8. I am using the standard azure linux agent for .net 8. I downloaded the libwkhtmlox.dll, libwkhtmltox.dlib, and libwkhtmltox.so libraries. Then added this to my .csproj to copy these over.

<ItemGroup>
  <!-- These libraries were copied from DinkToPdf nuget version 1.0.8 folder v0.12.4\64 bit.  -->
  <None Update="libwkhtmltox.dll">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="libwkhtmltox.dylib">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="libwkhtmltox.so">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
   </None>
</ItemGroup>

Hi @colbroth where did you get the files, via ssh-ing into the linux app service, I don't see these 3 files to add to my own project. Can you pinpoint me in the right direction?

Currently I'm using the workaround of @PaulIvanov which is working fine, but takes a lot of time with new releases/restarting, because each time this library needs to be installed.

colbroth commented 4 months ago

I was having this issue when updating from .net 6 to .net 8. Since this nuget was a branch off of DinkToPdf, I tried the DinkToPdf nuget version 1.0.8 instead and was able to run the application on a Linux agent using .net 8. I am using the standard azure linux agent for .net 8. I downloaded the libwkhtmlox.dll, libwkhtmltox.dlib, and libwkhtmltox.so libraries. Then added this to my .csproj to copy these over.

<ItemGroup>
  <!-- These libraries were copied from DinkToPdf nuget version 1.0.8 folder v0.12.4\64 bit.  -->
  <None Update="libwkhtmltox.dll">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="libwkhtmltox.dylib">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
  <None Update="libwkhtmltox.so">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
   </None>
</ItemGroup>

Hi @colbroth where did you get the files, via ssh-ing into the linux app service, I don't see these 3 files to add to my own project. Can you pinpoint me in the right direction?

Currently I'm using the workaround of @PaulIvanov which is working fine, but takes a lot of time with new releases/restarting, because each time this library needs to be installed.

I got the files off of github DinkToPdf which is located at https://github.com/rdvojmoc/DinkToPdf/tree/master/v0.12.4/64%20bit

HakanL commented 4 months ago

@colbroth Just be aware that using 7 years native binaries may have security risk implications.

DanTsion commented 4 months ago

hey @markandrewkato and @muraczewski, any update about this issue ? many people are starting their upgrade to .net 8 ... this issue will be trendy :/

HakanL commented 4 months ago

If someone can rebuild new binaries, using newer dependencies, then we can add them to this nuget package.

Chebura commented 3 months ago

same problem with alpine

bashito commented 3 months ago

The solution @colbroth mentioned worked, but images and stylesheets that are in external files do not load. Anyone else facing similar issue?

huiyuanai709 commented 3 months ago

hey @markandrewkato and @muraczewski, any update about this issue ? many people are starting their upgrade to .net 8 ... this issue will be trendy :/

same problem with alpine

FYI, Try this Dockerfile, It works for me

FROM amd64/debian:bookworm-slim AS runtime

ENV \
    # Configure web servers to bind to port 8080 when present
    ASPNETCORE_HTTP_PORTS=8080 \
    # Enable detection of running in a container
    DOTNET_RUNNING_IN_CONTAINER=true

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        ca-certificates \
        \
        # .NET dependencies
        libc6 \
        libgcc-s1 \
        libicu72 \
        libssl3 \
        libstdc++6 \
        tzdata \
        zlib1g \
        # Chinese font-family
        fonts-noto-cjk \
        fonts-wqy-microhei \
        fontconfig \
        curl \
    && curl -fSL --output wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb \
    && apt-get --fix-broken install -y --no-install-recommends ./wkhtmltopdf.deb \
    && rm -rf /var/lib/apt/lists/*

# Installer image
FROM amd64/buildpack-deps:bookworm-curl AS installer

# Retrieve .NET Runtime
RUN dotnet_version=8.0.7 \
    && curl -fSL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Runtime/$dotnet_version/dotnet-runtime-$dotnet_version-linux-x64.tar.gz \
    && dotnet_sha512='88e9ac34ad5ac76eec5499f2eb8d1aa35076518c842854ec1053953d34969c7bf1c5b2dbce245dbace3a18c3b8a4c79d2ef2d2ff105ce9d17cbbdbe813d8b16f' \
    && echo "$dotnet_sha512  dotnet.tar.gz" | sha512sum -c - \
    && mkdir -p /dotnet \
    && tar -oxzf dotnet.tar.gz -C /dotnet \
    && rm dotnet.tar.gz

# Retrieve ASP.NET Core
RUN aspnetcore_version=8.0.7 \
    && curl -fSL --output aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$aspnetcore_version/aspnetcore-runtime-$aspnetcore_version-linux-x64.tar.gz \
    && aspnetcore_sha512='c7479dc008fce77c2bfcaa1ac1c9fe6f64ef7e59609fff6707da14975aade73e3cb22b97f2b3922a2642fa8d843a3caf714ab3a2b357abeda486b9d0f8bebb18' \
    && echo "$aspnetcore_sha512  aspnetcore.tar.gz" | sha512sum -c - \
    && tar -oxzf aspnetcore.tar.gz ./shared/Microsoft.AspNetCore.App \
    && rm aspnetcore.tar.gz

# ASP.NET Core image
FROM runtime

# .NET Runtime version
ENV DOTNET_VERSION=8.0.7

# ASP.NET Core version
ENV ASPNET_VERSION=8.0.7

COPY --from=installer ["/dotnet", "/usr/share/dotnet"]

RUN ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

COPY --from=installer ["/shared/Microsoft.AspNetCore.App", "/usr/share/dotnet/shared/Microsoft.AspNetCore.App"]
ViktorKarpilov commented 1 month ago

I found working solution for me for alpine 8 looking like that

FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
FROM surnet/alpine-wkhtmltopdf:3.20.2-0.12.6-full as wkhtmltopdf

# Install dependencies for wkhtmltopdf
RUN apk add --no-cache \
    libstdc++ \
    libx11 \
    libxrender \
    libxext \
    libssl3 \
    ca-certificates \
    fontconfig \
    freetype \
    ttf-dejavu \
    ttf-droid \
    ttf-freefont \
    ttf-liberation \
    # more fonts
  && apk add --no-cache --virtual .build-deps \
    msttcorefonts-installer \
  # Install microsoft fonts
  && update-ms-fonts \
  && fc-cache -f 
sujeets-toast commented 3 weeks ago

I am also facing this same error when migrating to .Net 8.0. Is there anyone found any Solution?

Issue: "One or more errors occurred. (/app/Rotativa/Linux/wkhtmltopdf: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory\n)

***Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80

RUN apt-get -qq update
RUN apt-get -qq -y install curl
# Download the latest version of the tracer but don't install yet
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
    && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb

# copy everything else from publish
COPY ./publish ./

# Install the tracer
RUN mkdir -p /opt/datadog \
    && mkdir -p /var/log/datadog \
    && dpkg -i /tmp/datadog-dotnet-apm.deb \
    && rm /tmp/datadog-dotnet-apm.deb

# Enable the tracer
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/opt/datadog
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json

# Update and install required packages
RUN apt-get update -qq && \
    apt-get -y install libgdiplus libc6-dev libssl1.1

# Adjust permissions for wkhtmltopdf
RUN chmod 755 /app/Rotativa/Linux/wkhtmltopdf
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["dotnet", "OrderGuide..dll"]

I have tried the above solution, but it does not work for me. help is required if any one works.

I am migrating from .net 7.0 to .net 8.0

@PaulIvanov @ViktorKarpilov @huiyuanai709 @bashito @markandrewkato @intracodenl

huiyuanai709 commented 3 weeks ago

I am also facing this same error when migrating to .Net 8.0. Is there anyone found any Solution?

Issue: "One or more errors occurred. (/app/Rotativa/Linux/wkhtmltopdf: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory\n)

***Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80

RUN apt-get -qq update
RUN apt-get -qq -y install curl
# Download the latest version of the tracer but don't install yet
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
    && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb

# copy everything else from publish
COPY ./publish ./

# Install the tracer
RUN mkdir -p /opt/datadog \
    && mkdir -p /var/log/datadog \
    && dpkg -i /tmp/datadog-dotnet-apm.deb \
    && rm /tmp/datadog-dotnet-apm.deb

# Enable the tracer
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/opt/datadog
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json

# Update and install required packages
RUN apt-get update -qq && \
    apt-get -y install libgdiplus libc6-dev libssl1.1

# Adjust permissions for wkhtmltopdf
RUN chmod 755 /app/Rotativa/Linux/wkhtmltopdf
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["dotnet", "OrderGuide..dll"]

I have tried the above solution, but it does not work for me. help is required if any one works.

I am migrating from .net 7.0 to .net 8.0

@PaulIvanov @ViktorKarpilov @huiyuanai709 @bashito @markandrewkato @intracodenl

Check wlhtmltopdf is the last version && apt-get install -y --no-install-recommends fontconfig

curl -fSL --output wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb \ && apt-get --fix-broken install -y --no-install-recommends ./wkhtmltopdf.deb \

huiyuanai709 commented 3 weeks ago

I am also facing this same error when migrating to .Net 8.0. Is there anyone found any Solution?

Issue: "One or more errors occurred. (/app/Rotativa/Linux/wkhtmltopdf: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory\n)

***Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80

RUN apt-get -qq update
RUN apt-get -qq -y install curl
# Download the latest version of the tracer but don't install yet
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
    && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb

# copy everything else from publish
COPY ./publish ./

# Install the tracer
RUN mkdir -p /opt/datadog \
    && mkdir -p /var/log/datadog \
    && dpkg -i /tmp/datadog-dotnet-apm.deb \
    && rm /tmp/datadog-dotnet-apm.deb

# Enable the tracer
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/opt/datadog
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json

# Update and install required packages
RUN apt-get update -qq && \
    apt-get -y install libgdiplus libc6-dev libssl1.1

# Adjust permissions for wkhtmltopdf
RUN chmod 755 /app/Rotativa/Linux/wkhtmltopdf
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["dotnet", "OrderGuide..dll"]

I have tried the above solution, but it does not work for me. help is required if any one works.

I am migrating from .net 7.0 to .net 8.0

@PaulIvanov @ViktorKarpilov @huiyuanai709 @bashito @markandrewkato @intracodenl

First of all dotnet 8 based on debian:bookworm (debian 12) libssl1.1 -> libssl3 libssl1.1 is one of debian bullseye (debian 11) packages:

huiyuanai709 commented 3 weeks ago

@HakanL Hello is there a plan to update wkhtmltopdf dll to adapt to debian 12? image

sujeets-toast commented 3 weeks ago

I am also facing this same error when migrating to .Net 8.0. Is there anyone found any Solution? Issue: "One or more errors occurred. (/app/Rotativa/Linux/wkhtmltopdf: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory\n) ***Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80

RUN apt-get -qq update
RUN apt-get -qq -y install curl
# Download the latest version of the tracer but don't install yet
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
    && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb

# copy everything else from publish
COPY ./publish ./

# Install the tracer
RUN mkdir -p /opt/datadog \
    && mkdir -p /var/log/datadog \
    && dpkg -i /tmp/datadog-dotnet-apm.deb \
    && rm /tmp/datadog-dotnet-apm.deb

# Enable the tracer
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/opt/datadog
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json

# Update and install required packages
RUN apt-get update -qq && \
    apt-get -y install libgdiplus libc6-dev libssl1.1

# Adjust permissions for wkhtmltopdf
RUN chmod 755 /app/Rotativa/Linux/wkhtmltopdf
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["dotnet", "OrderGuide..dll"]

I have tried the above solution, but it does not work for me. help is required if any one works. I am migrating from .net 7.0 to .net 8.0 @PaulIvanov @ViktorKarpilov @huiyuanai709 @bashito @markandrewkato @intracodenl

First of all dotnet 8 based on debian:bookworm (debian 12) libssl1.1 -> libssl3 libssl1.1 is one of debian bullseye (debian 11) packages:

I have resolved after using bellow Dockerfile.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80

RUN apt-get -qq update
RUN apt-get -qq -y install curl
# Download the latest version of the tracer but don't install yet
RUN TRACER_VERSION=$(curl -s \https://api.github.com/repos/DataDog/dd-trace-dotnet/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -c2-) \
    && curl -Lo /tmp/datadog-dotnet-apm.deb https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm_${TRACER_VERSION}_amd64.deb

# copy everything else from publish
COPY ./publish ./

# Install the tracer
RUN mkdir -p /opt/datadog \
    && mkdir -p /var/log/datadog \
    && dpkg -i /tmp/datadog-dotnet-apm.deb \
    && rm /tmp/datadog-dotnet-apm.deb

# Enable the tracer
ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
ENV CORECLR_PROFILER_PATH=/opt/datadog/Datadog.Trace.ClrProfiler.Native.so
ENV DD_DOTNET_TRACER_HOME=/opt/datadog
ENV DD_INTEGRATIONS=/opt/datadog/integrations.json

# Install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
    zlib1g \
    fontconfig \
    libfreetype6 \
    libx11-6 \
    libxext6 \
    libxrender1 \
    libjpeg62-turbo \
    libpng16-16 \
    gdebi-core \
    wget

# Download and install wkhtmltopdf
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && \
    gdebi --non-interactive wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && \
    mkdir -p /app/Rotativa/Linux && \
    cp /usr/local/bin/wkhtmltopdf /app/Rotativa/Linux/wkhtmltopdf && \
    chmod +x /app/Rotativa/Linux/wkhtmltopdf && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["dotnet", "OrderGuide.dll"]
HakanL commented 3 weeks ago

I upgraded the Linux binaries to version 0.12.6.1 r3, which uses Debian 12/Bookworm. I don't have a good test set up here, can anyone see if Nuget version 1.5.95 of this package will work?

nydsteven commented 3 weeks ago

Nuget version 1.5.95 doesn't seem to be working on an out-of-the-box non-docker Linux app service on .net 8. I can't easily get the specific error message but can confirm it worked on the same non-docker Linux app service on .net 7. I haven't tested it with the custom startup script provided by @intracodenl though.

Thank you for upgrading the binaries and trying to help with this!

HakanL commented 3 weeks ago

The issue with @intracodenl solution is that it's using the old 12.5 version of the WkHtmlToX library, I don't think that's a good solution to be honest. I was hoping the latest version that was built for Bookworm was linked to libssl1.3, but I haven't confirmed as I don't have a good set up here at the moment.

michalmalo commented 1 week ago

I upgraded the Linux binaries to version 0.12.6.1 r3, which uses Debian 12/Bookworm. I don't have a good test set up here, can anyone see if Nuget version 1.5.95 of this package will work?

Unfortunately still having this issue on latest package

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.) Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.