BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hello,
I would like to use the HTML to PDF converter in an alpine docker container. The help page https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/docker mentions the following command to install required libraries:
RUN apt-get update && \
apt-get install -yq --no-install-recommends \
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
libnss3 libgbm1
What is the equivalent for alpine?
Thanks,
Erick
Hi Erick,
Thanks for contacting Syncfusion support,
We can use our Blink rendering engine in Alpine Linux docker images. Please refer below links for more information about the Blink rendering engine.
UG: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink
KB: https://www.syncfusion.com/kb/11299/how-to-convert-html-to-pdf-using-blink-in-linux-docker
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlinkAlpineDockerNet7738854080
We can convert HTML to PDF in Alpine-based Images using the below docker file by installing the chromium in Alpine Linux. please try this on your side and let us know the result.
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine3.17 AS base RUN apk update && \ apk upgrade && \ apk add --update ca-certificates && \ apk add chromium --update-cache --repository http://nl.alpinelinux.org/alpine/edge/community \ rm -rf /var/cache/apk/* WORKDIR /app EXPOSE 80 EXPOSE 443 FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build WORKDIR /src COPY ["BlinkAlpineDockerNet7/BlinkAlpineDockerNet7.csproj", "BlinkAlpineDockerNet7/"] RUN dotnet restore "BlinkAlpineDockerNet7/BlinkAlpineDockerNet7.csproj" COPY . . WORKDIR "/src/BlinkAlpineDockerNet7" RUN dotnet build "BlinkAlpineDockerNet7.csproj"-c Release -o /app/build FROM build AS publish RUN dotnet publish "BlinkAlpineDockerNet7.csproj"-c Release -o /app/publish /p:UseAppHost=false FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "BlinkAlpineDockerNet7.dll"] |
We need to install the below package in the docker image and we should use the BlinkBinaries folder from the Chromium installed location. For example, chromium installed location is “/usr/lib/chromium”. The below commands will install the chromium for Alpine docker, we can use the same for the conversion.
RUN apk update && \ apk upgrade && \ apk add --update ca-certificates && \ apk add chromium --update-cache --repository http://nl.alpinelinux.org/alpine/edge/community \ rm -rf /var/cache/apk/* |
Code snippet:
BlinkConverterSettings settings = new BlinkConverterSettings(); //Set Blink path settings.BlinkPath = "/usr/lib/chromium"; |
Please try the above solution and let us know the result.
Regards,
Karmegam