I am using the Reports.Web.NetCore package (v2018.3.2) in a .NET Core web API that I am trying to run within a Linux Docker container. This seems to work fine until I try to use custom fonts, at which point I get the following error being thrown:
Code: Select all
System.NotSupportedException: Could not open display (X-Server required. Check your DISPLAY environment variable)
at System.Drawing.Graphics.FromHwnd(IntPtr hwnd)
at Stimulsoft.Report.Export.PdfFonts.GetFontMetricsFullTrust(Font font, PdfFontInfo currentFontInfo, UInt16[] glyphMap, Boolean isWpf)
at Stimulsoft.Report.Export.PdfFonts.GetFontMetrics(Font font, PdfFontInfo currentFontInfo, UInt16[] glyphMap, Boolean isWpf)
at Stimulsoft.Report.Export.PdfFonts.InitFontsData(Boolean isWpf)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf1(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.Mvc.StiNetCoreReportResponse.ResponseAsPdf(StiReport report, StiPdfExportSettings settings, Boolean saveFileDialog)
at DummyApi.Controllers.ReportController.Get() in /app/Controllers/ReportController.cs:line 19
I've attached the ReportController.cs class that generates the report, as well as the .mrt report file itself and my Dockerfile.
Thanks,
Sam