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
366 stars 66 forks source link

Not able to generate report once deployed to Kubernates #106

Closed MJH073 closed 1 year ago

MJH073 commented 1 year ago

Hi Team,

I have used WkHTMLToPDF package and i am deploy the code to kubernated via Docker file. But i am not able to generate the report it saying Com component is not supported. Can you please help me with the command that i need to use to install dependency so that i can avoid this error. I tried with the option that you have already shared

RUN apt update RUN apt install -y libgdiplus RUN 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 gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb RUN apt install libssl1.1 RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

but that is not working for me, even i have removed apt to apk specific to linux os. Please suggest

M3LiNdRu commented 1 year ago

Hi @MJH073,

I sorted it out for k8s with the following lines:

RUN apt update
RUN apt install -y libgdiplus
RUN 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 libjpeg62
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
RUN gdebi --n wkhtmltox_0.12.6-1.focal_amd64.deb
RUN apt install libssl1.1
RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

Notice that I added libjpeg64 to dependencies to install and wkhtmltox is wkhtmltox_0.12.6-1.focal_amd64.deb because I use ubuntu as base image.

Hope it helps, happy coding!