-
Beta Was this translation helpful? Give feedback.
Answered by
Lucas-C
Apr 14, 2025
Replies: 1 comment 3 replies
-
Hi @pmaevsk Thank you for reaching out. We do not have a "clean" way to handle paragraph indents.
For now you can simply add whitespaces at the beginning of every paragraph: from fpdf import FPDF
TEXT = "Lorem ipsum d, olor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
INDENT = " " * 8
pdf = FPDF()
pdf.add_page()
pdf.set_font("Helvetica", size=12)
pdf.multi_cell(w=pdf.epw, h=6, text=INDENT + TEXT, align="J")
pdf.output("discuss_1405.pdf") Does that solve your problem @pmaevsk? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are right, this won't work well with justified text 😞
It would be nice to support "proper" paragraph indents as part of
fpdf2
.I just opened PR #1406 as a potential implementation for them.
You can test by installing
fpdf2
from this PR branch: