Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML: indent of lists on new line not flush #1212

Closed
xbln opened this issue Jun 22, 2024 · 5 comments
Closed

HTML: indent of lists on new line not flush #1212

xbln opened this issue Jun 22, 2024 · 5 comments

Comments

@xbln
Copy link

xbln commented Jun 22, 2024

The indentation of list items is not flush on a new line

Should be:

  • ldflfdkl kfdkfklfgd kdfködf ureuztrt uret rteiui tr reoiouerioure uoerotuueroou perpt perpi. repiter p reip tepi. reiptrei perpt prer tperi tepri

But is:

* jfjkjkfjfd dflfdlflklkfd lkfdklfdklmf fdklfdklfd ldfklfdklfd lkdfklfkld dflkfdkldf ldfklkkldfl fdldflkfdklklfd ldflkfdlkdfl ldf df fd lldf ldfllkfdklfkl lkfdklfdkl kldfklfdlkfd lkdflkfdlkdflk lkdfkllkfdkfd ldfl fd

Use of tag_indents={"li": 5} doesn´t help
I checked also ver 2.7.10 (master), but no improvement

@xbln xbln added the bug label Jun 22, 2024
@gmischler
Copy link
Collaborator

Welcome to fpdf2, @xbln !

As requested in the bug report template (that you summarily deleted instead of using it), please show us a minimal code example that produces the described result.

The explanation you gave us does not make it possible to reproduce the effect you're seeing.
And if we can't reproduce an error, then we can't fix it.

@Lucas-C
Copy link
Member

Lucas-C commented Jun 24, 2024

I agree with @gmischler, we need some SHORT code snippet to be able to help you 🙂

As mentioned in the bug report template that you must have seen, this page provides good explanation on how to craft a good minimal, reproducible example: https://stackoverflow.com/help/minimal-reproducible-example

@xbln
Copy link
Author

xbln commented Jun 24, 2024

Sorry, here is the code:

from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.write_html("""
<p>Is:</p>
<ul>
    <li>Unordered list</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
</ul>
<ol>
    <li>Ordered list</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</li>
</ol>
Should be:
<ul>
    <li>Ordered list</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dolore magna aliqua. Ut enim ad minim veniam</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dolore magna aliqua. Ut enim ad minim veniam</li>
</ul>
<ol>
    <li>Ordered list</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dolore magna aliqua. Ut enim ad minim veniam</li>
    <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dolore magna aliqua. Ut enim ad minim veniam</li>
</ol>
""")
pdf.output("html.pdf")

Output is:image

@gmischler
Copy link
Collaborator

A few days ago #1170 has been merged, which fixes this (already reported in #1073).

Most likely your test with 2.7.10 (current HEAD) was just before that.
Can you try that again please?

@gmischler
Copy link
Collaborator

Fixed in #1170.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants