htmlcssprintingcgiweasyprint

CSS print shows white Bar


I'm trying to create an ticket width the dimensions (203mmx82mm). This is in HTML and CSS via python (cgi, jinja2, weasyprint) the template will be converted to an pdf, which the user can download via a button on the website.

The HTML Body:

<body>
    <div id="ticket"></div>
</body>

And my CSS:

body{
    margin: 0;
    padding: 0;
    height: 82mm;
    width: 203mm;
    background: red;
}
#ticket{
    height: 82mm;
    width: 203mm;
    background-color: red;
    margin: 0 auto;
}
@page{
    size: 203mm 82mm;
    margin: 0;
    padding: 0;
}

I've chosen red to see it better. Even when the Body has the same color as the ticket, I still get an odd border in the printpreview (see Image blow) enter image description here

The white bar is also seen on the actual pdf. Can anyone help me?


Solution

  • After deleting the

    @page{
        size: 203mm 82mm;
        margin: 0;
        padding: 0;
    }
    

    and a pc restart i inserted agian the snippet. It works now.