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

Random Line Breaks #1158

Closed
assuntaw opened this issue Jul 9, 2020 · 3 comments
Closed

Random Line Breaks #1158

assuntaw opened this issue Jul 9, 2020 · 3 comments

Comments

@assuntaw
Copy link

assuntaw commented Jul 9, 2020

First and foremost: many thanks for this awesome tool! It’s far and away the best html-to-pdf solution I’ve come across 😊

One issue I’m having though is that the pdfs I generate contain random line-breaks from time to time, with seemingly no pattern to this behaviour. For example, a list item generated by Trix with only text inside (i.e. no additional HTML) will sporadically get broken like this (note the second list item has the exact same content in this case):

<ul>
  <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>

Screen Shot 2020-07-09 at 17 00 16

One workaround I’ve found is to set display: inline-block on the offending elements (and hacking list styles with content: "•" on li::before) , which makes the lines break as intended. But doing this also seems to prevent these elements from breaking as intended at the end of a page. The generator no longer splits the element across two pages:

Screen Shot 2020-07-09 at 17 13 11

So, in short, the issue I have at the moment is that I’m either stuck with random line breaks or unwanted page breaks. I cannot exclude the possibility of this being related to Trix, though it seems unlikely given that the HTML it generates doesn't differ from hard-coded HTML.

Has anyone experienced the same problem and, if so, were you able to find a solution?

@liZe
Copy link
Member

liZe commented Jul 9, 2020

Hello,

Thanks a lot for reporting this issue!

I think (hope?) that it’s a duplicate of #1051. Could you please try the current master branch and tell if the bug is fixed?

@assuntaw
Copy link
Author

That was it! Thanks a million for this and the quick response!

@liZe
Copy link
Member

liZe commented Jul 10, 2020

Good news. Have fun with WeasyPrint!

@liZe liZe closed this as completed Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants