How to set header or footer in cordova-plugin-html2pdf?

I want to create a PDF file in a cordova application using cordova-plugin-html2pdf. There are no errors here, and the creation is fine, but I don’t know how to place the header (or footer) on each page of the generated PDF file.

This is the code I have for creating a PDF:

var htmlDoc = "<html><head><link rel='stylesheet' href='assets/css/main.css'></head><body>"+document.getElementById("myDocument").innerHTML+"</body></html>";

    window.html2pdf.create(htmlDoc,
            "test.pdf",
            function(){
                console.log("PDF Creation Success!");
            },
            function(){
                console.log("PDF Creation Fail!");
            }
        );

How to add a title to the generated PDF?

Thank!

+4
source share

All Articles