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>
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