-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
It seems some winapi dependencies still in place.
Unhandled Exception: System.DllNotFoundException: Unable to load shared library 'user32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libuser32.dll: cannot open shared object file: No such file or directory
at PdfSharp.Internal.NativeMethods.GetDC(IntPtr hwnd)
Program.cs
using System.Text;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
namespace PdfSharpApp
{
class HelloWorld
{
static void Main(string[] args)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
PdfDocument document = new PdfDocument();
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
gfx.DrawString("Hello, World!", font, XBrushes.Black, new XRect(0, 0, page.Width, page.Height), XStringFormats.Center);
const string filename = "HelloWorld.pdf";
document.Save(filename);
}
}
}
Dockerfile
FROM microsoft/dotnet:2.2-aspnetcore-runtime
# install System.Drawing native dependencies
RUN apt-get update \
&& apt-get install -y --allow-unauthenticated \
libc6-dev \
libgdiplus \
&& rm -rf /var/lib/apt/lists/*
# make links to libdl.so and libgdiplus.so
RUN ln -s /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so
RUN ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so
ARG source
WORKDIR /app
COPY ${source:-bin/Debug/netcoreapp2.2/publish} .
ENTRYPOINT ["dotnet", "PdfSharpApp.dll"]
sychare, gitowiec, NickMckloski, jeffaya and sehcheese
Metadata
Metadata
Assignees
Labels
No labels