fpdf2 icon indicating copy to clipboard operation
fpdf2 copied to clipboard

HTML blockquotes are not indented

Open dmail00 opened this issue 2 years ago • 3 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

dmail00 avatar Dec 24 '23 00:12 dmail00

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?

Lucas-C avatar Dec 30 '23 19:12 Lucas-C

@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.

gmischler avatar Feb 22 '24 13:02 gmischler

A first implementation of this feature will be added by PR #1124

Lucas-C avatar Feb 27 '24 21:02 Lucas-C

Closing this now that PR #1124 has been released: https://github.com/py-pdf/fpdf2/releases/tag/2.7.9

Lucas-C avatar May 24 '24 09:05 Lucas-C