1

I'm trying to generate PDFs from HTML using DinkToPdf library with docker, but i can't get that showing the image from docker container running, while debugging from windows I have no problems:

enter image description here

I have added many libraries to my dockerfile that i have seen in others topics, but i have not been successful. My dockerfile is as follows:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY . .
WORKDIR /src/WebApi
RUN dotnet restore
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1    
RUN apt-get update && apt-get install -y libgdiplus \
        ca-certificates \
        xvfb \
        libfontconfig \
        wkhtmltopdf \
        fontconfig \
        zlib1g \
        fontconfig \
        libfreetype6 \
        libx11-6 \
        libxext6 \
        libxrender1 \
        libjpeg62-turbo \
        libxcb1 \
        xfonts-75dpi \
        xfonts-base \
        openssl \
        wget \
        gdebi
WORKDIR /app
COPY --from=build /src/WebApi/out ./
ENTRYPOINT ["dotnet", "WebApi.dll"]

Any idea what library I need to add to the dockerfile to show the images?

PS: My html code:

<table class='tbl' cellpadding='5'>
    <tbody>
        <tr>
            <td class='tbl-img'>
                <img src='https://pngimg.com/uploads/batman/batman_PNG75.png' alt='' height='51' width='200' />
            </td>
        </tr>
        <tr>
            <td class='tbl-title'>THIS IS THE TITLE OF THE DOCUMENT</td>
        </tr>
        <tr>
            <td class='tbl-subtitle'>THIS IS THE SUBTITLE OF THE DOCUMENT</td>
        </tr>
    </tbody>
</table>

2 Answers2

0

The solution as specified in not the solution, at all. I tried with base64 string of the image and dinktopdf is showing the image well locally but on deployment to linux server, the image is not shown.

-1

The solution for this issue was added on github: github.com/rdvojmoc/DinkToPdf/issues/159

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 09 '22 at 09:36