Szpadel / chrome-headless-render-pdf

225 stars 67 forks source link

CSS is ignored #57

Closed jmarkos closed 5 years ago

jmarkos commented 5 years ago

Hi, I cannot get any css to work - I'm trying to render this file

<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
    <title></title>
    <style type='text/css' media='all'>
      .redbackground {
        background-color: #FF0000;
      }
    </style>
  </head>
  <body>
    <div class="redbackground">Red</div>
    <div style="background-color: #00FF00;">Green</div>
  </body>
</html>

with this command

chrome-headless-render-pdf --url "file:///tmp/test.html" --pdf /tmp/test.pdf

No color is ever rendered. Am I missing something obvious?

bartvanhoutte commented 5 years ago

Try adding "--include-background".

jmarkos commented 5 years ago

Thanks @bartvanhoutte !