py-pdf / fpdf2

Simple PDF generation for Python
https://py-pdf.github.io/fpdf2/
GNU Lesser General Public License v3.0
993 stars 227 forks source link

Line spacing for a long line that is displayed in several lines. #1213

Closed rfc-st closed 3 days ago

rfc-st commented 1 week ago

Hello!,

First of all, thank you for this library ^^.

Is there any parameter, or configuration option, to define the spacing for a long line of text that is displayed in several lines?.

As you can see in the following image (https://imgur.com/a/y8X088R), the fourth line starting with "Nota : " is displayed in two lines ... without any vertical spacing between them; both lines are displayed too close together.

Thanks!

andersonhc commented 1 week ago

Hello!,

First of all, thank you for this library ^^.

Is there any parameter, or configuration option, to define the spacing for a long line of text that is displayed in several lines?.

As you can see in the following image (https://imgur.com/a/y8X088R), the fourth line starting with "Nota : " is displayed in two lines ... without any vertical spacing between them; both lines are displayed too close together.

Thanks!

You can set the spacing with the parameter "h". The default value of this parameter is the font size in pt.

Lucas-C commented 1 week ago

Hi @rfc-st, and thank you for your kind words!

As a complementary answer, if you are using the multi_cell() method, you can also play with the max_line_height parameter.

Do you have other questions @rfc-st? Tell us if we can close this issue, or else we'll try to help you further 🙂

Lucas-C commented 1 week ago

Also, a side question: do you see a place in our documentation where we should document this better? 😅

rfc-st commented 6 days ago

Hello,

Thanks to both of you for the advices!: I will try them this weekend. And about the documentation, if you don't mind leaving this issue open for a few more days, I will check it thoroughly. I'm sure your advice is indicated.

Best regards,

rfc-st commented 3 days ago

Hello,

I have succeeded, by using YPos! (https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.YPos):

https://imgur.com/a/DaPtwtq

Thanks for your advices and for this great library!. Btw, i am using it on https://github.com/rfc-st/humble/ ... In case you would like to include a mention in https://py-pdf.github.io/fpdf2/#community :)

Regards,