Skip to content

multi_cell string part(sub-string) make bold or add colors... #617

Answered by Lucas-C
akash-exactspace asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @akash-exactspace

FPDF.multi_cell() has a markdown parameter that can be set to True to allow setting **bold** or __italic__ text: https://pyfpdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.multi_cell

Regarding colors, this is not currently possible with multi_cell(), but you can use FPDF.write_html(): https://pyfpdf.github.io/fpdf2/HTML.html

pdf.write_html("<font color="#00ff00"><p>hello in green</p></font>")

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@akash-exactspace
Comment options

Answer selected by akash-exactspace
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