Gur*_*uru 2 node.js npm puppeteer
我正在尝试自定义页眉和页脚。但我无法将背景颜色添加到页脚。这就是我正在尝试做的。
page.pdf({
path: 'test.pdf',
format: 'a4',
landscape: '!data.isPortrait',
footerTemplate: '<div class="footer" style="height:75px;position: absolute;top:auto;left:0px;right:0px;left:0px;background-color:red;">\ </div>',
displayHeaderFooter: true,
margin: {
top: "75px",
bottom: "75px"
}
});
Run Code Online (Sandbox Code Playgroud)
环境
Puppeteer version:1.1.0
Platform / OS version:ubuntu 16.04
Node.js version:8.9
Run Code Online (Sandbox Code Playgroud)
要将背景颜色添加到页眉/页脚或 Puppeteer 中的页面,我们需要添加一个额外的 css 属性,-webkit-print-color-adjust: exact. 现在它工作正常。