We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Need help to find all pre-requsite packages on alpine3.17 container


We are running our ASPNet 7.0 application and use Syncfusion to genreate the HTML report into PDF file. Things are working fine when the application is running on windows. 

When the application moves to run on container with Alpine linux 3.17 image from MS (https://hub.docker.com/_/microsoft-dotnet-aspnet?tab=description), we got the following errors:

Failed to convert html to pdf. Details: Syncfusion.Pdf.PdfException: An error occurred trying to start process 'xvfb-run' with working directory '/App'. No such file or directory   at Syncfusion.HtmlConverter.HtmlConverter.ConvertHtmlToPdf(String url, Int32 width, Int32 height, String tempFile)   at Syncfusion.HtmlConverter.HtmlToPdfConverter.Convert(String url)   at Syncfusion.HtmlConverter.HtmlToPdfConverter.Convert(String html, String baseurl)

It's understood that there are pre-requsite packages for Linux as mentioned in here (as follow) but we couldn't find all the packages under Alpine 3.17.

  • $ sudo apt-get update
  • $ sudo apt-get install xvfb
  • $ sudo apt-get install libssl1.0-dev
  • $ sudo apt-get install libx11-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-shm0-dev libxcb-util0-dev libxcb-xfixes0-dev libxcb-xkb-dev libxcb1-dev libxfixes-dev libxrandr-dev libxrender-dev

  • Could you please advise how we can get the necessary packages on Alpine Linux?

    1 Reply

    SN Santhiya Narayanan Syncfusion Team March 28, 2023 11:26 AM UTC

    Our WebKit rendering engine and its dependencies are not working in alpine based Linux docker images. However, we can use our Blink rendering engine in alpine Linux docker images. Please refer below links for more information about 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/BlinkAlpineDockerNet7-1524766345

    We can convert HTML to PDF in alpine based Images using below docker file by installing the chromium in alpine Linux. please try this in 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 docker image and we should use the BlinkBinaries folder from the chromium installed location. 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.  

    Live Chat Icon For mobile
    Up arrow icon