We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Draw PdfLightTable Causes App to Hang When Setting Column Widths

The following code is the reproduction of the problem. The program hangs on the call to Draw(). If we don't set the Column widths then the code executes fine. Seems to work fine with PDFGrid. 


            var doc = new PdfDocument();

            var page = doc.Pages.Add();

            var graphics = page.Graphics;

            var xPos = 0;

            var yPos = 0;

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add(new DataColumn("ABC"));

            dataTable.Columns.Add(new DataColumn("XYZ"));

            for (int i = 0; i < 3; i++)


                DataRow dr = dataTable.NewRow();

                dr[0] = "ABC";

                dr[1] = "XYZ";



            PdfLightTable table = new PdfLightTable


                DataSource = dataTable


            table.Style.ShowHeader = true;

            table.Style.CellPadding = 3;

            table.Columns[0].Width = 3;

            table.Columns[1].Width = 12;

            var tableWidth = graphics.ClientSize.Width - 10;

            var resultsTable = table.Draw(page, xPos, yPos, tableWidth);


2 Replies

IJ Irfana Jaffer Sadhik Syncfusion Team February 14, 2023 11:27 AM UTC

We are currently checking on this and will provide further details shortly.

Meanwhile, can you please confirm why you prefer a light table instead of PdfGrid?

MK Moorthy Karunanithi Syncfusion Team February 16, 2023 12:11 PM UTC

On further analysis, we found that the problem was caused by the column width value being less than the length of a single character of the header text. This caused the problem to occur on the light table. Therefore, we suggest increasing the column width value or reducing the column font size to resolve this issue.

However, we suggest using PdfGrid instead of PdfLightTable, as it offers more customization and styling support. You can refer to the following documentation for further details.

Please refer pdf grid documentation link,


Live Chat Icon For mobile
Up arrow icon