When using text regions, calling ln() with a custom h value will cause an unwanted second line break after the first line of the next paragraph.
Minimal code
import fpdf
pdf = fpdf.FPDF()
pdf.set_font("Helvetica", size=16)
pdf.add_page()
pdf.write(text="GOOD\nGOOD")
pdf.ln(16)
pdf.write(text="GOOD\nGOOD")
pdf.ln(16)
with pdf.text_columns() as region:
region.write(text="BAD\nBAD")
region.ln(16)
region.write(text="BAD\nBAD")
pdf.output("output.pdf")
Result PDF looks something like this:
GOOD
GOOD
GOOD
GOOD
BAD
BAD
BAD
BAD
As you can see an uncalled for line break was added before the last line.
Environment
- Operating System: Windows
- Python version: 3.14
fpdf2 version used: 2.8.7
When using text regions, calling
ln()with a customhvalue will cause an unwanted second line break after the first line of the next paragraph.Minimal code
Result PDF looks something like this:
As you can see an uncalled for line break was added before the last line.
Environment
fpdf2version used: 2.8.7