Created
June 7, 2015 23:33
-
-
Save asessa/bf389070d76aaaf3987b to your computer and use it in GitHub Desktop.
node-html-pdf header/footer test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pdf = require('html-pdf'); | |
var options = { | |
'format': 'A4', | |
'border': '1cm', | |
'header': { | |
'height':'5cm' | |
}, | |
'footer': { | |
'footer': '5cm' | |
} | |
} | |
var html = '<body>' + | |
' <div id="pageHeader"><img src="https://www.google.com/images/srpr/logo11w.png"></div>' + | |
' <div id="pageContent">' + | |
' this is the main content on page 1' + | |
' <p style="page-break-after:always;"></p>' + | |
' this content goes on page 2 to test header/footer' + | |
' </div>' + | |
' <div id="pageFooter">' + | |
' <img src="https://www.google.com/images/srpr/logo11w.png">' + | |
' </div>' + | |
'</body>'; | |
pdf.create(html, options).toFile(function(err, res) { | |
if (err) return console.log(err); | |
console.log(res); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same issue with any assets in the header/footer ( using the html pageHeader include )
I've used the "base" option to set an absolute path for the public folder.
The images and the fonts are working properly in the page content but none are working in pageHeader and pageFooter.
I can confirm that images are working using an external image.
Any workaround in mind ?