PDF > Complex report with over 250 items > Index out of range

We use aspose.pdf, and even on the latest stable version of 21.5.0 when ever I attempt to generate a complex report, using text segments, fragments, paragraphs, cells, rows, and tables etc… that has around 250 rows or more, I get the following error when saving the PDF to a stream for export/email. It appears to me like it may be either timing out, or overflowing.

This did not happen until adding the use of text segments.

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at Aspose.Pdf.Cells.get_Item(Int32 index)
at Aspose.Pdf.Table.#=z6QfzH1SN5dIb(Row #=zoJeFmwY=, Int32 #=ziQQnNi8=, Page #=zgbH$Y_A=, List1 #=zaPJKhmC84o$K) at Aspose.Pdf.Table.#=zRxX32zo=(Double& #=zZua2Sy8=, Double& #=ztmzv3Cg=, Boolean #=z9s0bbGuXchyo, Double #=zWz4hu9eFxNAY, Double #=zhSSDwkg=, Page #=zgbH$Y_A=, Boolean #=zhIxqQV61op_X, List1 #=zy9Yn9ko=)
at #=z3UozzAtA3ZdgYt$zuAV7VQ4=.#=zRxX32zo=()
at Aspose.Pdf.Page.#=zQxL$lgs=(Page #=zgbH$Y_A=)
at Aspose.Pdf.Page.#=zn5iMv7YSNSsprhuNKQ==()
at Aspose.Pdf.Document.ProcessParagraphs()
at Aspose.Pdf.Document.#=z8LgBqxx6eJzr(Stream #=zBHt2J8Q=, SaveOptions #=zcoAPxT8fjLuM)
at Aspose.Pdf.Document.Save(Stream output)

        byte[] fileArray;
        using (var pdf = new PdfDocument())
            VwpPdfWriter.GeneratePdfReport(pdf, pdfReport, reportId, timekeeper);

            using (var stream = new MemoryStream())
                pdf.Save(stream); //<-- error occurs here
                fileArray = stream.ToArray();

        return fileArray;


Could you please share complete sample code snippet or a sample console application which is able to replicate the same exception you are facing? We will test the scenario in our environment and address it accordingly.