Skip to content

Image height in table #1120

Answered by Lucas-C
LarsK1 asked this question in Q&A
Feb 21, 2024 · 3 comments · 3 replies
Discussion options

You must be logged in to vote

Alright, I think I understand better your problem now. Thanks for providing examples.

So you have two requirements:

  • having at least two table rows with images on each page
  • having images filling the cells that contains them

Given your images dimensions, the only solution IMHO is to adapt the width of the table columns:

from fpdf import FPDF

ZEILE = (
    ("Example 1", "https://larskusch.b-cdn.net/wp-content/uploads/2023/12/Lostplace-Hotel-062-980x1470.jpg"),
    ("Example 2", "https://larskusch.b-cdn.net/wp-content/uploads/2023/12/Lostplace-Hotel-059-980x1470.jpg"),
)

doc = FPDF()
doc.add_page()
doc.set_font("Helvetica", size=12)
with doc.table(col_widths=(4, 3)) as table:
	ueberschrift =

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@LarsK1
Comment options

@Lucas-C
Comment options

Answer selected by LarsK1
@LarsK1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants