Closed vikeen closed 6 years ago
Hi!
There are multiple problems and solutions to your problem, but the main problem is that column layout is experimental in WeasyPrint and it's obviously buggy with padding and margins. I'll try to fix it during the next day.
@liZe, thank you. Is there anything I can help with?
@liZe, thank you. Is there anything I can help with?
Yes! I've committed 7361966 that should fix your problem, you can try and tell me if it's better this way.
Column layout is currently experimental, related code needs some love :heart:. It's also really really slow, especially when blocks around columns have extra spacing. Reporting real life bugs is really helpful! If you're interested in improving this feature and have some Python + CSS skills, you can take a look at the columns_layout
in blocks.py
.
@liZe, thanks. Checking the commit out now.
Weasyprint is one of a few critical services to my application. I would be more than happy to give you a hand improving it. As you said, performance is a bit of an issue, but I can overcome that with async rending and emailing the pdf when it's done. That isn't a big deal for me at the moment.
I'll take a look at the block.py
and spend some time learning.
@liZe, worked like a charm! - adventure.pdf
Thanks for the quick turn around! The ability to specify exact page dimensions while controlling all aspects of the page html gives me immense control.
Background I have a web application that lets users create design PDFs. In this application, we provide the user a WYSIWYG editor in conjunction with a draft-js rich text editor.
In order to "mirror" the web applications editor content, I save off each page as a div to be rendered by my backend.
Example:
Description
When I render the html output in a browser it looks fine. Notice how the top and bottom of the page fit nicely with a 0.75in border around it.
However, when this html is rendered by weasyprint the margins of the page get messed up. The top of the page has some blank space and the bottom looks like it's running off the page.
HTML and CSS
The issue probably lies with how I'm trying to "reset" the printed page and use my page div. What do you think?