Chromium launches failed while converting the HTML to PDF document in headless mode

44 views
Skip to first unread message

Karmegam Seerangan

unread,
Aug 7, 2025, 9:36:53 AMAug 7
to headless-dev
Hi All,

We are using Chromium's headless mode to convert HTML to PDF documents and images. When running the HTML to PDF conversion inside a Windows Docker container, Chromium fails to launch and crashes during initialization. As a result, the conversion process does not complete successfully in this environment.

Please take a look at the Docker file below.

# This stage is used when running from VS in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

# This stage is used to build the service project
FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-1809 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["HTMLtoPDF_ASP_NET_Core_Windows_Docker/HTMLtoPDF_ASP_NET_Core_Windows_Docker.csproj", "HTMLtoPDF_ASP_NET_Core_Windows_Docker/"]
RUN dotnet restore "./HTMLtoPDF_ASP_NET_Core_Windows_Docker/HTMLtoPDF_ASP_NET_Core_Windows_Docker.csproj"
COPY . .
WORKDIR "/src/HTMLtoPDF_ASP_NET_Core_Windows_Docker"
RUN dotnet build "./HTMLtoPDF_ASP_NET_Core_Windows_Docker.csproj" -c %BUILD_CONFIGURATION% -o /app/build

# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./HTMLtoPDF_ASP_NET_Core_Windows_Docker.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false

# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HTMLtoPDF_ASP_NET_Core_Windows_Docker.dll"]


How to launch Chromium with headless mode in a Windows Docker container?

Regards,
Karmegam S

Karmegam Seerangan

unread,
Aug 22, 2025, 5:30:54 AMAug 22
to headless-dev, Karmegam Seerangan

Hi All,


Any updates on this?

Could someone assist with converting HTML to PDF inside a Windows Docker container using Chromium in headless mode?

Alternatively, is there another solution for converting HTML to PDF within a Windows Docker container?


Regards,

Karmegam S

 


Reply all
Reply to author
Forward
0 new messages