py-pdf/fpdf2

No way to control line spacing inside table cell

glebarez opened this issue · 2 comments

Hello, I can't figure out a way to control line spacing inside table cell.
Currently the default setting is too large, and seems like a whole empty line is in between.
Is there a way to shrink it ?

Code

from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.set_font("helvetica")
with pdf.table(first_row_as_headings=False) as table:
    row = table.row()
    row.cell("line1\nline2")
pdf.output("test.pdf")

Result

image

Hi @glebarez!

Have you checked the line_height setting? It's mentioned there in the docs:

with pdf.table(first_row_as_headings=False, line_height=5) as table:

Thanks, it worked!