wkhtmltopdf - background color doesn't fill second page

ぐ巨炮叔叔 提交于 2019-12-10 10:45:13

问题


I am trying to convert an HTML to a PDF document with wkhtmltopdf.

Command I am running is wkhtmltopdf ./test.html test.pdf

Software version:

wkhtmltopdf -V                  
wkhtmltopdf 0.12.5 (with patched qt)

The content is dynamic therefore I don't really know where it will end.

Unfortunately when the content renders to the second page the background stops with the content.

HTML below, any help would be fully appreciated and make an old developer happy after struggling so much :)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<head>
  <title>Testing PDF</title>

  <link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">

  <style>
    html {
      height: 100%;
      background: #f3f8fb;
    }

    body {
      font-family: "Lato", sans-serif;
      color: black;
      background: #f3f8fb;
    }
  </style>
</head>

<body>

  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>
  <p>This is a test with lots of dynamic content</p>


</body>

</html>

回答1:


What I end up doing is adding 1 page full of empty paragraphs and then delete the extra page with pdftk



来源:https://stackoverflow.com/questions/51204839/wkhtmltopdf-background-color-doesnt-fill-second-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!