This commit is contained in:
Mrx
2026-03-13 18:07:24 +08:00
parent f16274d1e9
commit 209ffec51d
16 changed files with 309 additions and 1176 deletions

View File

@@ -87,6 +87,7 @@ func (r *DatabaseTableRenderer) RenderTable(pdf *gofpdf.Fpdf, tableData *TableDa
if currentY+estimatedHeaderHeight > pageHeight-bottomMargin {
r.logger.Debug("表头前需要分页", zap.Float64("current_y", currentY))
pdf.AddPage()
pdf.SetY(ContentStartYBelowHeader)
}
// 绘制表头
@@ -448,6 +449,7 @@ func (r *DatabaseTableRenderer) renderRows(pdf *gofpdf.Fpdf, rows [][]string, co
zap.Float64("current_y", currentY),
zap.Float64("page_height", pageHeight))
pdf.AddPage()
pdf.SetY(ContentStartYBelowHeader)
// 在新页面上重新绘制表头
if len(headers) > 0 && len(headerColWidths) > 0 {
newHeaderStartY := pdf.GetY()
@@ -523,6 +525,7 @@ func (r *DatabaseTableRenderer) renderRows(pdf *gofpdf.Fpdf, rows [][]string, co
zap.Int("row_index", rowIndex),
zap.Float64("row_height", maxCellHeight))
pdf.AddPage()
pdf.SetY(ContentStartYBelowHeader)
startY = pdf.GetY()
}