我正在尝试使用 puppeteer 生成 pdf,但生成的 pdf 宽度很大。我想要一个 pdf 文件,它在一页中显示所有内容,并且宽度必须为 4.8 厘米,其中页面高度可以是其内容的任何长度。
我在pdf中添加了配置
{
path : filePath,
printBackground : true,
width : '4.8cm'
}
Run Code Online (Sandbox Code Playgroud)
到页面我将配置添加到视口
{
width : 136,
height : 842,
deviceScaleFactor : 1
}
Run Code Online (Sandbox Code Playgroud)
但最终的结果并没有改变
我正在对节点服务器进行 api 调用。这是一个后调用,但我收到错误作为响应,但 firebase 上的数据发生了变化。
const header : HttpHeaders = new HttpHeaders()
header.append('Content-Type', 'application/x-www-form-urlencoded')
this.http.post('http://localhost:3000/s/getKey', { seqKey : 'invoices' }, {
headers : header
}).subscribe(data => {
console.log(data)
})
Run Code Online (Sandbox Code Playgroud)
更新