NodePDF icon indicating copy to clipboard operation
NodePDF copied to clipboard

Issue with the header and footer options

Open cpchan718 opened this issue 11 years ago • 5 comments

Hi,

I am having an issue with the header and footer option. When I place an attribute into a html tag like style='some css'. The header and footer does not show. I think there is an issue with the quotations within quotations. Like so:

'header': {
                    'height': '1cm',
                    'contents': "<span style='text-align:center'><small>" + titleheader + "</small></span>"
},
'footer': {
                    'height': '1cm',
                    'contents': '<span style="text-align:right"><small>{currentPage}</small></span>'
}

Thou, it does work without the attributes. Like so:

'header': {
                    'height': '1cm',
                    'contents': "<center><small>" + titleheader + "</small></center>" 
},
'footer': {
                    'height': '1cm',
                    'contents': '<span><center><small>{currentPage}</small></center></span>'
}

It will be great if I can align the footer page numbers to the right of the PDF.

Thanks!

cpchan718 avatar Oct 31 '14 15:10 cpchan718

Would also love it if this was more flexible

emadow avatar Jun 09 '15 20:06 emadow

Could you please try:

'contents': '<span style="text-align:center"><small>' + titleheader + '</small></span>'

n3o77 avatar Jun 09 '15 20:06 n3o77

That's what I've been trying in my implementation, but to no avail.

emadow avatar Jun 09 '15 20:06 emadow

Interesting. Sorry then I have to debug a little bit more. Header and footer stuff was quite tricky but I'm sure it works in some of my projects. Could you also try to set another property like background-color instead of text-align center, maybe something with the viewport is wrong. And in general header and footer are like own pages, so it should include html and body tags.

n3o77 avatar Jun 09 '15 20:06 n3o77

Seems to choke whenever a tag has any properties. So all of these cause it to hang:

contents: '<div class="test">content</div>'
contents: '<div class=test>content</div>'
contents: "<div class='test'>content</div>"

however

contents: '<div>content</div>'

works fine

emadow avatar Jun 09 '15 21:06 emadow