the error in fastreport when exporting pdf
Under the same query conditions, there is no problem in exporting xls, but when exporting pdf,
the following error message will appear sometimes, Please help to answer this question,tks.
language: C#
version: "2024.1.3"
|ERROR|WebApi.Middleware.ExceptionMiddleware|異常: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.set_Item(Int32 index, T value)
at FastReport.Export.Pdf.PDFExport.WriteFont(ExportTTFFont pdfFont)
at FastReport.Export.Pdf.PDFExport.AddPDFFooter()
at FastReport.Export.Pdf.PDFExport.Finish()
at FastReport.Export.ExportBase.Export(Report report, Stream stream)
at FastReport.Report.Export(ExportBase export, Stream stream)
at WebApi.Area.Final.Controllers.AsfRptReferenceController.AsfPrintReference(DefaultCondition model)
Comments
Hello!
The error could not be reproduced in the latest version of FastReport.Core 2026.2.8.
What to do:
Update the packages to the latest version, 2026.2.8.
Ensure that, in the Web API, a new instance of Report and PDFExport is created for each HTTP request (report objects are not thread-safe for parallel export).
If the crash occurs with a specific, uncommon font on the server, temporarily test the report using a system font (Arial / Liberation Sans / DejaVu Sans) or by setting `pdfExport.EmbeddingFonts = false`, and attach the problematic .ttf/.frx file for accurate diagnosis.