HTML blockquotes are not indented
Closed this issue · 4 comments
Describe the bug
HTML blockquotes are not indented and as a consequence nested blockquotes are not indented.
Minimal code
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
pdf.write_html("before<blockquote>level 1</blockquote>after")
pdf.write_html("before<blockquote>level 1<blockquote>level 2</blockquote></blockquote>after")
pdf.output("test_blockquotes.pdf")
Environment
Please provide the following information:
- Operating System: Windows
- Python version: 3.11.3
fpdf2
version used: 2.7.7
Hi @dmail00
As the default HTML <blockquote>
is usually rendered with a default margin-left: 40px
,
we could indeed handle some left margin for thos elements.
Interestingly, the code the renders <bloquote>
tags already as some kind of "indent" logic:
https://github.com/py-pdf/fpdf2/blob/2.7.7/fpdf/html.py#L500
But I don't think it ever worked...
@dmail00: would you like to contribute a PR to implement this?
@gmischler: do you think that this kind of indent should be handled by paragraphs / text regions?
@gmischler: do you think that this kind of indent should be handled by paragraphs / text regions?
Yes, as in #1073, giving Paragraph()
s an indent
option would probably be the cleanest solution here.
Closing this now that PR #1124 has been released: https://github.com/py-pdf/fpdf2/releases/tag/2.7.9