table
Appends a tabular layout with the given columns and arbitrary rows.
The DSL is designed for data-driven tables — you typically declare a com.conamobile.pdfkmp.dsl.TableScope.header once and then iterate through a list of model objects with forEach to add a body row per record.
Example:
table(
columns = listOf(
TableColumn.Fixed(60.dp),
TableColumn.Weight(2f),
TableColumn.Weight(1f),
),
border = TableBorder(color = PdfColor.Gray, width = 1.dp),
cornerRadius = 8.dp,
) {
header { cell("ID"); cell("Name"); cell("Status") }
users.forEachIndexed { i, user ->
row(background = if (i % 2 == 0) PdfColor.White else PdfColor.LightGray) {
cell(user.id.toString())
cell(user.name)
cell(user.status)
}
}
}Parameters
specification of every column's width. Mix TableColumn.Fixed for explicit widths with TableColumn.Weight for proportional columns. Must contain at least one entry.
outline and separator-line configuration. Pass TableBorder.None to disable borders.
outer rectangle corner radius. The clipping shape extends to row backgrounds too — first/last row corners visibly round off when this is non-zero.
default padding applied to every cell. Override per row via row(cellPadding = ...) or per cell via cell(padding = ...).
when the page's com.conamobile.pdfkmp.layout.PageBreakStrategy.Slice strategy splits the table across pages, re-draw the header row at the top of every continuation page. Ignored for tables that fit on one page or have no header.