ststeiger / PdfSharpCore

Port of the PdfSharp library to .NET Core - largely removed GDI+ (only missing GetFontData - which can be replaced with freetype2)
Other
1.04k stars 231 forks source link

System.IndexOutOfRangeException: Index was outside the bounds of the array. #440

Open petr-vojtech opened 2 months ago

petr-vojtech commented 2 months ago

Hello. I use PdfSharpCore version 1.3.63 (.NET Core 6) to generate a PDF-file with code like this: var pdf = PdfGenerator.GeneratePdf(html, PageSize.A4, 10, null, null, null);

I get an exception if I call this code simultaneously in two or more threads: System.IndexOutOfRangeException: Index was outside the bounds of the array. at PdfSharpCore.Fonts.OpenType.OpenTypeFontface.CreateFontSubSet(Dictionary`2 glyphs, Boolean cidFont) at PdfSharpCore.Pdf.Advanced.PdfCIDFont.PrepareForSave() at PdfSharpCore.Pdf.Advanced.PdfType0Font.PrepareForSave() at PdfSharpCore.Pdf.Advanced.PdfFontTable.PrepareForSave() at PdfSharpCore.Pdf.PdfDocument.PrepareForSave() at PdfSharpCore.Pdf.PdfDocument.DoSave(PdfWriter writer) at PdfSharpCore.Pdf.PdfDocument.Save(Stream stream, Boolean closeStream)

Can you plese solve the issue? Thank you