PDF Output: Fix a bug that prevented the first style property in the header or footer template from being applied

This commit is contained in:
Kovid Goyal 2019-10-06 23:07:56 +05:30
parent 77dc63cab9
commit d84626293c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -921,7 +921,7 @@ def add_header_footer(manager, opts, pdf_doc, container, page_number_display_map
root = container.parsed(name)
body = last_tag(root)
body.attrib.pop('id', None)
body.set('style', 'margin: 0; padding: 0; border-width: 0; background-color: unset')
body.set('style', 'margin: 0; padding: 0; border-width: 0; background-color: unset;')
job = job_for_name(container, name, Margins(0, 0, 0, 0), page_layout)
def m(tag_name, text=None, style=None, **attrs):
@ -1006,7 +1006,7 @@ def add_header_footer(manager, opts, pdf_doc, container, page_number_display_map
style = ans.get('style') or ''
style = (
'margin: 0; padding: 0; height: {height}pt; border-width: 0;'
'display: flex; align-items: center; overflow: hidden; background-color: unset').format(height=height) + style
'display: flex; align-items: center; overflow: hidden; background-color: unset;').format(height=height) + style
ans.set('style', style)
for child in ans.xpath('descendant-or-self::*[@class]'):
cls = frozenset(child.get('class').split())