Description
Proposed solution
- Allow Align.C to be passed as a value for
.l_margin
in TextStyle - When this
.l_margin
is used in FPDF._use_title_style(), if it isAlign.C
, then horizontally align the text
The PR implementing this should include unit tests using FPDF.start_section()
Discussed in #1280
Originally posted by Benoite142 October 10, 2024:
Hi,
I've been trying to center a TitleStyle for quite some time now. I've been using a TitleStyle for the
start_section
function used in the TOC placeholder and I am having a lot of trouble trying to center the TitleStyle. I know we can easily center some cell or text withalign='C'
but I found no way of doing that for the TitleStyle. I know we can put a value to thel_margin
to make it look like it is centered, but I can't really use that since all of my titles differs in length.
I also tried aligning everything to the center of the page, but that still doesn't work with TitleStyle and the sections.
Worst case scenario is that I put everything on the left, but I would really want it to be centered.
If anyone knows how I could do this, please let me know.
Thank you for you time 😊