-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
Background image does not cover page margin area #1993
Comments
Hi! I think that there’s no bug in WeasyPrint this time.
The image is not clipped, and is actually drawn on the left and right margin boxes (it fits vertically and overflows horizontally). That’s what we expect. If you want to display the image on the page + margins, you can either:
|
Thanks for your suggestions. I still think an CSS Paged Media Module Level 3, 3.1. Page Backgrounds and Painting Order:
|
Thanks a lot for your detailed answer 😍.
You’re right, WeasyPrint and PDFReactor position the content according to the page’s padding box, but the other tools use the margin box.
I agree with this sentence: the painting area is the whole page, including the margins. That’s why WeasyPrint paints the page background on the whole page when we set a color or a repeating background image for example. But there’s more:
This means that the (0, 0) coordinate is by default the page’s padding area origin, and the padding area doesn’t include the margins. And this position can be changed using At least that’s what I understand! 😄 Unfortunately, I can’t find any official test for that, so I don’t know what’s "right" here. I’m open to discussion, but I’m not convinced yet! |
Thanks for taking time to investigate the issue 😄 . I fully understand that you do not want to implement something that is ambiguous in the CSS spec and where no tests for the expected behavior exist. I have re-read the parts of the CSS spec you linked and think you are right about
If I understand it correctly, it should be possible to let the background cover the whole page (including its margin area) by settings |
That’s right! Fixing this looks like to be a useful way to provide you a clean solution.
That’s a bit strange, it looks like |
I also think it is meant that background images should only be replicated on every page that the |
One thing to keep in mind is interaction with actual bleed area, as full page images generally should also cover the bleed area. |
As explained in the specification, with
So, the origin is not the bleed box, it’s the margin box. But it’s not a real problem: if you want images to be displayed in the bleed area, it’s possible to use negative values. And that’s actually a good idea: 100% width means 21cm for A4, and if we have bleed areas we have to use something greater to get something drawn on the bleed area. Once again, the problem is not that the image is not drawn on the margin / bleed area, it’s already possible. The problem is "only" the default origin. |
I think that the bug is fixed and tested, feedback is welcome! |
With |
@liZe I think this is not released in 60.2 can you release a new version with this? |
It’ll be included in version 61. |
@liZe thanks, any idea of the 61 timeline / release date? |
We have a couple of things to fix before releasing, and it may take some time. If you really want to use this feature, you can install the main branch. |
hi @liZe Thanks for the reply, no pressure but we want to upload a release on our ubuntu server and want a stable product out there. If we buy you coffee for a week, will that motivate you to help us out 😉 |
Hello @akashbit! |
When using
background-image
withbackground-size: cover;
on a@page
, the page margin area is not covered. However, when usingbackground-color
, the page margin area is covered. The problem might be similar to #1943The text was updated successfully, but these errors were encountered: