fpdf2 icon indicating copy to clipboard operation
fpdf2 copied to clipboard

FlexTemplate multiline: It looks like that it puts space/newline between lines. Expected behavior?

Open yi0n opened this issue 1 year ago • 4 comments

Hi,

for this behavior, I searched here and in the 'forked from' repo this kind of issue and also SO, but haven't found anything that's close related. I posted the problem already on SO with my Code and Screenshots. Please have a look: https://stackoverflow.com/questions/78817119/fpdf2-template-multiline-space-between-text-like-a-newline Maybe a line_height issue?

Thanks in advance.

yi0n avatar Aug 01 '24 07:08 yi0n

Hi @yi0n , At first glance you can adjust the space between the lines by adjusting the difference between 'y1' and 'y2'. Let me know if that doesn't help and I'll take a look in the code.

andersonhc avatar Aug 01 '24 12:08 andersonhc

The multiline text in the templates is just a wrapper around multi_cell(), where h = y2 - y1.

It is important to remember that this is the height of one single line, not of the complete block of text.

gmischler avatar Aug 01 '24 12:08 gmischler

Thank you. That explains a lot. Now I tried by setting the y1-y2 difference at first by the font size what resulted in still to much space. I figured out that it seems like a good value for the line height is half the size of the font-size.

Sidenote: As I consulted the docs for table cell padding at https://py-pdf.github.io/fpdf2/fpdf/table.html, i noticed that it says _ padding (left, top, right, bottom) for the cell._ but through my testing I experienced its: (top, right, bottom, left) Maybe someone can change that.

yi0n avatar Aug 07 '24 11:08 yi0n

Hi @yi0n 🙂

Given your last comment, I understand that your problem is solved?

Do you have any more questions, or can we close this issue?

Lucas-C avatar Aug 19 '24 11:08 Lucas-C

Closing this issue now

Lucas-C avatar Oct 04 '24 12:10 Lucas-C