Table positioning in fpdf2 #918
-
I am trying to 1) position a table below another cell. Then 2) position another table right of that. When I align table 'left', and align the other table 'right', the second table ('right') is positioned below the first (on the right side of the page), instead of next to it. I am looking for a way to position two tables at a precise location on the page, just as can be done with text. Any ideas or examples how this can be solved? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Welcome to fpdf2, @Constance2023, like most content in fpdf2, tables are placed between the page margins horizontally (depending on the "align" parameter), and below the current y position vertically. So if you want to use left and right alignment for your horizontal placement, then all you need to do is to remember the current value of |
Beta Was this translation helpful? Give feedback.
Before starting the first table, eg.:
table_top_y = pdf.y
and before starting the second table:
pdf.y = table_top_y
the "y" attribute of the FPDF class is how it maintains its current vertical position internally. You can check its value at any time. You can obviously also change it, if you want to deviate from the standard top-down sequence of element placement on the page.