I have an HTML page with a small fixed (i.e. non-scrolling) full-bleed (i.e. zero-margin) background around the edge. I'm trying to set up the @media print
stylesheet so that it prints well, and I'd like to keep the full-bleed background in the printed (PDF) version as well.
If I set @page { margin: 0; }
then the background extends to the edge of the PDF exactly how I want, but page-broken text goes all the way to the top and bottom of the page without any margin. If I set @page { margin: 2cm; }
then I get reasonable margins on top and bottom of every page, but the PDF has an ugly blank white border that ruins the full-bleed background effect. I've tried adding a @page { background-image: url(...); }
but this doesn't seem to work at all in Chrome.
Is there some way to get the best of both worlds? To keep both the full-bleed background image but also have reasonable top/bottom-margins on the page breaks?
I found a somewhat-related question about wkhtmltopdf but it was never answered.