Issue with Mass Printing Invoices in ERPNext

I am experiencing a problem with mass printing invoices in ERPNext.

When I open an invoice through the POS Invoice List, click the Print icon, and select a print profile, the PDF generates correctly based on the selected format. (see image 1)

However, if I select one or more invoices from the POS Invoice List, go to Actions, and choose Print (see image 2), the generated PDF is completely empty—no content, not even a blank page (see image 3). This happens irrespective of which Print format I select.

I am logged in as the admin with full permissions, so I’m not sure what I might be doing wrong.

I am self-hosting with the following configuration:
ERPNext: v15.44.0 (version-15)
Frappe Framework: v15.48.1 (version-15)
wkhtmltopdf version 0.12.6

Can you help?

Many Thanks

Image 1

Image 2

================================================
Image 3

Did not see the issue in v15. Looks like that is POS Invoice? Can you try the demo/default Sales invoice template and see if there are issues?
If you are still setting up, play around with vanilla demo v15 to get a grasp on how things work and then move to customize.

I already tried using the “standard” invoice template. It did not work (i.e. I see the same issue)

Tried the Sales Invoice as well and the issue I face is similar with the printing

in Sales Invoice it mentioned the following error

Invalid wkhtmltopdf version
PDF generation may not work as expected.Please contact your system manager to install correct version.
Correct version : wkhtmltopdf 0.12.x (with patched qt).

Can someone guide me to how I do this?
As mentioned earlier I have this version
wkhtmltopdf version 0.12.6

To get the qt version I run the following commands:

1. sudo apt purge wkhtmltopdf -y
2. wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
3. sudo dpkg -i wkhtmltox_0.12.6-2.jammy_amd64.deb

at this point I got a libjpeg-turbo8 issue. Aparently libjpeg-turbo8 does not come with Debian 12
so I had to do the following

4. wget http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.1.5-2ubuntu2_amd64.deb
5. sudo dpkg -i libjpeg-turbo8_2.1.5-2ubuntu2_amd64.deb
6. sudo dpkg -i wkhtmltox_0.12.6-2.jammy_amd64.deb
7. sudo apt install -f
8. sudo reboot

to verify i did the following

wkhtmltopdf --version
wkhtmltopdf 0.12.6.1 (with patched qt)

then

wkhtmltopdf http://ft.com output.pdf

It worked!!!
However, now I have the following issue when printing anything

Traceback (most recent call last):
  File "apps/frappe/frappe/utils/pdf.py", line 49, in pdf_body_html
    return template.render(args, filters={"len": len})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "env/lib/python3.11/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 19, in top-level template code
  File "env/lib/python3.11/site-packages/jinja2/sandbox.py", line 392, in call
    if not __self.is_safe_callable(__obj):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "env/lib/python3.11/site-packages/jinja2/sandbox.py", line 276, in is_safe_callable
    getattr(obj, "unsafe_callable", False) or getattr(obj, "alters_data", False)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: '__' is undefined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1725, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/print_format.py", line 234, in download_pdf
    pdf_file = frappe.get_print(
               ^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 2136, in get_print
    response = get_response_without_exception_handling("printview", 200)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/website/serve.py", line 47, in get_response_without_exception_handling
    return renderer_instance.render()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 84, in render
    html = self.get_html()
           ^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/website/utils.py", line 530, in cache_html_decorator
    html = func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 95, in get_html
    self.update_context()
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 163, in update_context
    data = self.run_pymodule_method("get_context")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 223, in run_pymodule_method
    return method(self.context)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/www/printview.py", line 56, in get_context
    body = get_rendered_template(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/www/printview.py", line 227, in get_rendered_template
    html = frappe.get_attr(hook_func[-1])(jenv=jenv, template=template, print_format=print_format, args=args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/print_designer/print_designer/pdf.py", line 86, in pdf_body_html
    return fw_pdf_body_html(template, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/pdf.py", line 52, in pdf_body_html
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 602, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 567, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 518, in _raise_exception
    raise exc
frappe.exceptions.PrintFormatError: Error in print format on line 19: '__' i

I am at a loss. Anything I try doesn’t seem to be working. I believe there is a serious issue with PDF in ERPnext that have yet to be resolved.
Can you help?