Email-SalesInvoice-PDF parts missing

Hi there,

i have an issue with the print formats.
I created a new one. Customizing it by using the grad’Ndrop editor.
= > fine so far. Normal Print work.

Now i try to send this invoice as email attachment (the default web functionality) select my custom format.

The arriving email contains the invoice as PDF.
But here is the point: In this PDF the invoice has no header or footer.
It shows just the middle part with the containing data.
(frappe/erpnext v13.8.x) updated today…
What I am missing here?..
Im doing it wrong?
How is it meant to be used?

Is there may an example to put a file based custom print format on an custom_app, so i can push it into a git repository?

ty for helping out…

bg Desian

Firstly you need to test if the invoice actually gets converted to pdf properly with header and footer. Dont go on what you see on print preview. Press the pdf button to convert it. Mostly probably it is same as the email attachment. Check your code for header and footer error.

You maybe printing directly using browser without converting to pdf. Which is why it looks fine.

This is correct.
The generated PDF (the PDF-Button on the invoice) also do not show the header.
Why this is different from the print view? This is confusing to me.
How i can make it happen to see the regular header/footer every site on the PDF?
What is the intended behavior?

bg Desien

Share your print format. You need to set like this for header

{%- from "templates/print_formats/standard_macros.html" import add_header -%}
{% set delivery = [] %}
<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}>
        {% if letter_head %}
        <div class="letter-head" style="margin-top: 15px!important;">{{ letter_head }}</div>

Add this in footer

<div class="row">
  <div id="footer-html" class="visible-pdf">
    {% if not no_letterhead and footer %}
    <div class="letter-head-footer">
      {{ footer }}
    </div>
    {% endif %}
    <p class="text-center small page-number visible-pdf">
      {{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }}
    </p>
  </div>

And in CSS do this

@media print {
  footer {page-break-after: always;}
}
1 Like

Thank you for your effort.
The print format is made only by clicking in the frontend on my local dev-server.
So i don’t know how to share it.
Inserting this code into this HTML-Form was not repeating the header on every page of the pdf.

So i was trying to figure out to use your hint by creating this files:

custumization/print_format/my_format.json = > used
custumization/print_format/my_format.html
(used /erpnext/account/print_format/sales_auditing_voucher/* as an example)

after “bench migrate” i see my custom format in the list of print formats.

If im selecting the format in preview, i get

  • “No preview available.”
    And when i try to see the PDF
  • {{ body }}

I was not able to find documentation about the format of the json or how i can exactly bring this custom print format to live.

How i convince the print-format to use my html file?
Where i can find documentation, that also explain things in the source code rather than only by using the frontend?
Maybe: witch project i can checkout for an example?

bg Desian

Aah. I think you are using the internal drag and drop print format builder. Share images then of the setup.

Check your print settings to be sure Print with letterhead etc are checked.