Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] runningsPath alternative by using a function #201

Open
dawadam opened this issue Jan 3, 2021 · 0 comments
Open

[feature] runningsPath alternative by using a function #201

dawadam opened this issue Jan 3, 2021 · 0 comments

Comments

@dawadam
Copy link

dawadam commented Jan 3, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant