I want to print header on all pages in my new custom print format with page numbers.
As my table contain many rows so i want to dynamically break page & print header with table contents.
So is it possible ?
1 Like
Hello @kolate_sambhaji
I used the above code still not able to get header & footer on all pages.
Is there any css for header & footer?
Can you share your code?
Sorry @kolate_sambhaji, i was checking in normal print, this feature is only visible in pdf was known to me later.
Thank You so much for the help.
1 Like
In header-html, write your html code to bold text.
please check above code, you need to write head code in div id header-html, or you can add header from Letter Head doctype.
When I add the following into my Print Format:
<div id="header-html" class="hidden-pdf">
{{ add_header(0,1,doc,letter_head, no_letterhead) }}
</div>
I get this error: 'add_header' is undefined
Has this been changed?
Full traceback:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 62, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 939, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/www/printview.py", line 188, in get_html_and_style
no_letterhead=no_letterhead, trigger_print=trigger_print),
File "/home/frappe/frappe-bench/apps/frappe/frappe/www/printview.py", line 159, in get_html
html = template.render(args, filters={"len": len})
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 2, in top-level template code
UndefinedError: 'add_header' is undefined
Found it! It should be {{ letter_head }}
in there:
<div id="header-html" class="hidden-pdf">
{{ letter_head }}
</div>
2 Likes
what have you put in your letter head
file?