Skip to content

Commit 5912ea6

Browse files
author
Olivier Bonnaure
committed
fix: handle empty headers
1 parent b9d536a commit 5912ea6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

.lua/pdfgenerator.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ function PDFGenerator:drawTable(options, table_options)
549549
self.current_table.header_options = options.header_options
550550
self.current_table.data_options = options.data_options
551551

552-
local first_line_height = self:calculateMaxHeight(options.header_columns)
552+
local first_line_height = self:calculateMaxHeight(options.header_columns or {})
553553
if options.data_columns[1] then
554554
first_line_height = first_line_height + self:calculateMaxHeight(options.data_columns[1])
555555
end
@@ -613,7 +613,6 @@ function PDFGenerator:calculateTextHeight(column)
613613
local line_height = fontSize * 1.5 - (number_of_lines / 1.5) -- Standard line height
614614
local text_height = number_of_lines * line_height + padding_y * 2 -- Include padding
615615
-- Update max_height if this item is taller
616-
-- if column.text then text_height = text_height + padding_y * 2 end
617616
column.lines = number_of_lines
618617
column.height = number_of_lines * line_height
619618

@@ -638,7 +637,6 @@ function PDFGenerator:calculateMaxHeight(columns)
638637
for _, content in ipairs(column.content) do
639638
if content.type == "text" then
640639
text_height = text_height + self:calculateTextHeight(content) / 1.5
641-
--text_height = text_height / 1.5
642640
end
643641

644642
if content.type == "image" then

0 commit comments

Comments
 (0)