PdfLightTable: Can''t draw table, because there is not enough space for it.

I have a report that prints a group header then detail lines in a PdfLightTable for each break group in a result set. The datasource for the table is PdfHeaderSource.Rows with the detail table being populated programatically as the process iterates through the result set, creating a new instance of the table with each break group.

My problem is that depending on where (y co-ordinate) on the page the table is to be drawn, I sometimes get this error - "Can't draw table, because there is not enough space for it." If I change the vertical spacing between elements on the page the error does not occur, change it back - get the error. All with the same result set. I am using the result.Bounds property to find where the last table finished and calculate the starting position of the next table. I have set

format.Break = PdfLayoutBreakType.FitPage; and
format.Layout = PdfLayoutType.Paginate;

Because it is the same data set with or without the error I do not believe it is problem with horizontal (column width) fit. It is vertical fit.

What have I missed in setting pagination? How can I determine what space is required and what space is available so as to avoid the problem?

Thanks,
David


1 Reply

PJ Priyadharshini J Syncfusion Team January 17, 2011 11:30 AM UTC

Hi David,

Thank you for the details.

We are not able to reproduce the issue. We can draw a PdfLightTable in a specified location using the result.Bounds property and also paginate bounds property of the PdfLightTableLayoutFormat as shown in the code below:

result.Bounds Property:

PdfLayoutResult result = table.Draw(page, new RectangleF(10, 60, 300, 0),format1);
PdfLayoutResult result1 = table.Draw(page, new RectangleF(result.Bounds.X, result.Bounds.Bottom+20, result.Bounds.Width, result.Bounds.Height), format1);


PaginateBounds Property:

PdfLightTableLayoutFormat format2 = new PdfLightTableLayoutFormat();
format2.Layout = PdfLayoutType.Paginate;
format2.Break = PdfLayoutBreakType.FitElement;
format2.PaginateBounds = new RectangleF(result.Bounds.X,(2* result.Bounds.Bottom)+20,400,0);
table.Draw(page,format2.PaginateBounds,format2);


I have placed a simple sample for the same in the location below:
ForumTable1783537962.zip

Kindly try this and also could you please provide more details about your exact requirement. This will help us a lot in further investigation.

Regards,
Priyadharshini.


Loader.
Up arrow icon