wkhtmltopdf - 背景颜色不会填满第二页 [英] wkhtmltopdf - background color doesn't fill second page

查看:63
本文介绍了wkhtmltopdf - 背景颜色不会填满第二页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 wkhtmltopdf 将 HTML 转换为 PDF 文档.

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

我正在运行的命令是 wkhtmltopdf ./test.html test.pdf

软件版本:

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,任何帮助将不胜感激,并让老开发人员在经历了这么多努力后感到高兴 :)

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 页的空段落,然后用 pdftk

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

这篇关于wkhtmltopdf - 背景颜色不会填满第二页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆