简体   繁体   中英

DinkToPdf Net Core not showing image in docker container

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:

在此处输入图像描述

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>

此问题的解决方案已添加在 github 上:github.com/rdvojmoc/DinkToPdf/issues/159

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM