Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Does fpdf2 support different font size in .multi_cell()? #786

Closed
jonahmarc opened this issue May 17, 2023 · 4 comments
Closed

Q: Does fpdf2 support different font size in .multi_cell()? #786

jonahmarc opened this issue May 17, 2023 · 4 comments
Labels

Comments

@jonahmarc
Copy link

Hi.
I was just wondering if there are ways on how to enable different font size of the txt when using .multi_cell()?

If there aren't any, I would like to request this feature (if possible). I think it's very helpful when generating pdfs especially with sections/paragraphs that are hard to break apart. Also, very useful when implementing dynamic contents.

Thank you.

@gmischler
Copy link
Collaborator

Hi @jonahmarc ,

to mix different fonts within a paragraph, you currently need to use the .write() method.

The downside of that is that at the moment it only supports left aligned text. I'm working to change that (as soon as I get around to finishing it) as outlined in #339 .

@Lucas-C
Copy link
Member

Lucas-C commented May 17, 2023

I fully agree with @gmischler answer.

For now, an alternative approach can be write_html():

pdf.write_html('Hello <font size="7">world</font>!')

@jonahmarc
Copy link
Author

@gmischler @Lucas-C Thank you. Hoping to more features.

@gmischler
Copy link
Collaborator

I've just checked in #897, which should be a general solution to this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants