New to Telerik Document Processing? Start a free 30-day trial
Avoiding Table Splits Across Pages Using FixedContentEditor in RadPdfProcessing
Updated on Jun 5, 2026
Environment
| Version | Product | Author |
|---|---|---|
| 2025.1.205 | RadPdfProcessing | Desislava Yordanova |
Description
When you add tables in RadPdfProcessing using the RadFixedDocumentEditor, tables may split across pages if they do not fit within the remaining space on the current page. To ensure a table fits entirely on one page and starts on a new page if necessary, measure the table size and calculate the remaining page height.
This article shows how to prevent tables from splitting across pages and apply page breaks before adding tables using FixedContentEditor.
Solution
Measure the table and calculate the remaining page height. For precise positioning, use the FixedContentEditor. This editor allows you to measure and draw tables with exact positioning. The following example shows an implementation:
csharp
static void Main(string[] args)
{
GeneratedTableWithFixedContentEditor();
}
private static void GeneratedTableWithFixedContentEditor()
{
RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();
FixedContentEditor editor = new FixedContentEditor(page);
Point currentPosition = new Point(0, 0);
List<Table> tables = new List<Table>();
tables.Add(GenerateTable(50));
tables.Add(GenerateTable(15)); //can fit
//tables.Add(GenerateTable(30)); //can't fit
foreach (Table item in tables)
{
Size size = item.Measure();
if (size.Height < (page.Size.Height - currentPosition.Y))
{
editor.Position.Translate(currentPosition.X, currentPosition.Y);
currentPosition = new Point(0, currentPosition.Y + size.Height + 10);
editor.DrawTable(item);
}
else
{
page = document.Pages.AddPage();
editor = new FixedContentEditor(page);
editor.DrawTable(item);
currentPosition = new Point(0, size.Height + 10);
}
}
PdfFormatProvider provider = new PdfFormatProvider();
string outputFilePath = "exported.pdf";
File.Delete(outputFilePath);
File.WriteAllBytes(outputFilePath, provider.Export(document, TimeSpan.FromSeconds(10)));
Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
}
private static Telerik.Windows.Documents.Fixed.Model.Editing.Tables.Table GenerateTable(int numberOfRows)
{
Table table = new Table();
table.LayoutType = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.TableLayoutType.FixedWidth;
for (int i = 0; i < numberOfRows; i++)
{
TableRow row = table.Rows.AddTableRow();
TableCell cell = row.Cells.AddTableCell();
cell.Blocks.AddBlock().InsertText("Row: "+i);
}
return table;
}