[feature] runningsPath alternative by using a function
dawadam opened this issue · 0 comments
dawadam commented
Hi, great job.
It will be practical to use a function for placing header and footer, programmatically, out of a file.
Like this :
let headerContent = function (pageNum, numPages) {
return "<h1>Header <span style='float:right'>" + pageNum + " / " + numPages + "</span></h1>"
}
let options = {
cssPath: this.rootPath + "/style.css",
header: {
height: "1cm",
contents: headerContent
}
}
fs.createReadStream(this.rootPath + "/in.md")
.pipe(markdownpdf(options))
.pipe(fs.createWriteStream(this.rootPath + "/out.pdf"))
It will be also useful for making custom header and footer be adding variables.