我通过选项设置PDFKIT页眉/页脚。一切都很好。
options = {
'page-size' : 'Letter',
'margin-top' : '0.75in',
'margin-right' : '0.75in',
'margin-bottom': '0.5in',
'margin-left' : '0.75in',
'header-left' : 'something',
'header-right' : '[section]',
'footer-right' : '[page]',
}
但是如何通过css代码格式化它们?
我认为这会起作用,但事实并非如此。
@page {
@top-left {
font-size: .8rem;
color: red;
}
}
感谢。
答案 0 :(得分:0)
我刚刚发现尺寸,字体等......只是更多的选择。糟糕。
const http = require("http")
function getRawHeader(req, res) {
const httpVersion = req.httpVersion
let str = `${req.method.toUpperCase()} ${req.url} HTTP/${httpVersion}\n`
for (let i = 0; i < req.rawHeaders.length; i = i + 2) {
str += `${req.rawHeaders[1]} : ${req.rawHeaders[i + 1]}\n`
console.log(i)
}
let written = false
req.on("readable", (chunk) => {
const data = req.read()
if (!written) {
res.write(str)
res.write("\n")
}
written = true
if (data) res.write(data)
})
}
http.createServer((req, res) => {
getRawHeader(req, res)
req.on("end", () =>res.end())
}).listen(7200, () => console.log("server f is running"))