Szpadel/chrome-headless-render-pdf

CSS is ignored

Closed this issue · 2 comments

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?

Try adding "--include-background".