Question

I am working on a set of HTML reports that need to be printed. Everything looks OK on the screen, but a white box surrounds all of the text elements when the page is printed.

Here is a screen shot of the page on screen:
screen shot of the page on screen

Here is a screen shot of a PDF printed using the system print dialog:
screen shot of a PDF printed using the system print dialog

Here's the HTML:

<!DOCTYPE html>
    <html>
        <head>
            <link rel="Stylesheet" type="text/css" href="../css/style.css" media="all"/>
        </head>
    <body>
        <div id="container">
        <div id="menu">
            <b>Menu</b><br>
            HTML<br>
            CSS<br>
            JavaScript</div>
        <div id="content">
            Content goes here</div>
    </body>
</html>

Here is the CSS:

@media print
{
    /* Hides elements on page when printed */
    .nonPrinting
    {
        display: none;
    }
    /* Forces the background colors / images to display when printing */
    body
    {
        -webkit-print-color-adjust : exact;
    }
}

#container
{
    width:500px;
}

#menu
{
    background-color:#FFD700;
    height:200px;
    width:100px;
    float:left;
}
#content
{
    background-color:#EEEEEE;
    height:200px;
    width:400px;
    float:left;
}

The pages are running inside of a node-webkit application.

Was it helpful?

Solution

Have you tried assigning a specific background-color on these elements?

Try

background-color : transparent;

or

background-color: #FFD700;

on the child elements of #menu

EDIT

This is how the 'printed' pdf looks like for me:

pdf at my computer

EDIT:

Maybe it's a driver issue?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top