PdfSharpCore
PdfSharpCore copied to clipboard
"Image could not be read" Whan Calling Paragraph.AddImage(path)
I'm using dotnet 5.0 in a linux docker container. My docker file has the following command to install libgdiplus:
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgdiplus libc6-dev libx11-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
I try to add an image to the header paragraph with the following code:
var headerParagraph = row.Cells[0].AddParagraph();
var logoPath = $"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}/Assets/FinalLogo.png";
headerParagraph.AddImage(logoPath);
I also tried with by turning the image into a base64 string. I verified that the string is valid, but I get the same error.
The pdf renders a grey square with red text that says "Image could not be read."
Is this a bug or am I doing something wrong?