Template Preview vs PDF output Issue

I’ve downloaded one of the prebuilt templates and have added banking deposit details at the bottom of it(outside the table).

When I preview an invoice the template displays correctly, but when I PDF the invoice, the banking details are not in the output file.

This is the template I based my version from.

Below is my modified template code, it’s only the table at the bottom with the banking details which is changed from the original.

<table style="padding: 30px">
    <thead>
        <tr>
            <td colspan="99">
                <table style="margin-bottom: 20px"><tr>
                    <td style="font-weight: bold; font-size: 32px">{{ title }}</td>
                    {% if business.logo != null %}<td style="text-align: right"><img src="{{ business.logo }}" style="max-height: 150px; max-width: 300px"></td>{% endif %}
                </tr></table>

                <table style="margin-bottom: 20px"><tr>
                    <td>
                        <div><b>{{ recipient.name }}</b> {{ recipient.code }}</div>
                        <div>{{ recipient.address | newline_to_br }}</div>
                        <div>{{ recipient.identifier }}</div>
                    </td>
                    <td style="border-right-width: 1px; padding-right: 20px; text-align: right">
                        {% for field in fields %}
                        <div style="font-weight: bold">{{ field.label }}</div>
                        <div style="margin-bottom: 10px">{{ field.text }}</div>
                        {% endfor %}
                    </td>
                    <td style="padding-left: 20px; width: 1px; white-space: nowrap">
                        <div style="font-weight: bold">{{ business.name }}</div>
                        <div>{{ business.address | newline_to_br }}</div>
                        <div>{{ business.identifier }}</div>
                    </td>
                </tr></table>

                <div style="font-size: 14px; font-weight: bold; margin-bottom: 20px">{{ description }}</div>
            </td>
        </tr>
        <tr>
            {% for column in table.columns %}
            <td style="font-weight: bold; padding: 5px 10px; text-align: {{ column.align }}; border-left-width: 1px; border-bottom-width: 1px; border-top-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if column.nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ column.label }}</td>
            {% endfor %}
        </tr>
    </thead>
    <tbody>
        {% for row in table.rows %}
        <tr>
            {% for cell in row.cells %}
            <td style="padding: 5px 10px; text-align: {{ table.columns[forloop.index0].align }}; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if table.columns[forloop.index0].nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ cell.text | newline_to_br }}</td>
            {% endfor %}
        </tr>
        {% endfor %}
        <tr>
        {% for column in table.columns %}
            <td style="border-bottom-width: 1px; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}">&nbsp;</td>
        {% endfor %}
        </tr>
        {% for total in table.totals %}
        <tr>
            <td colspan="{{ table.columns | size | minus:1 }}" style="padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.label }}</td>
            <td style="border-left-width: 1px; white-space: nowrap; border-right-width: 1px; border-bottom-width: 1px; padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.text }}</td>
        </tr>
        {% endfor %}

        {% for field in custom_fields %}
        <tr>
            <td colspan="99">
                <div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
                <div>{{ field.text | newline_to_br }}</div>
            </td>
        </tr>
        {% endfor %}

        {% if emphasis.text != null and emphasis.positive %}
        <tr><td colspan="99"><div style="text-align: center; margin-top: 40px"><span style="color: #006400; border-width: 5px; border-color: #006400; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div></td></tr>
        {% endif %}

        {% if emphasis.text != null and emphasis.negative %}
        <tr><td colspan="99"><div style="text-align: center; margin-top: 40px"><span style="color: #FF0000; border-width: 5px; border-color: #FF0000; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div></td></tr>
        {% endif %}

    </tbody>
</table>
<table style="padding: 30px">
  <tr>
<td colspan="99">Please pay this invoice into the following bank account:<br><br></td>
</tr>


<br><br>

<tr>
  <td><b>Name</b></td>
  <td>Person in Business</td>
</tr>
<tr>
  <td><b>Bank</b></td>
  <td>Bank of Money</td>
</tr>
<tr>
  <td><b>BSB</b></td>
  <td>123-456</td>
</tr>
<tr>
  <td><b>Acct. #</b></td>
  <td>123456789</td>
</tr>
</table>

You do not have to modify the template for this. If you want to show the bank details in a Sales invoice then create a custom field under settings for Sales Invoice. Set it to show on printed documents and enter your bank details in the default text space.

The reason I’d like to include this detail in the template is because sometimes my terms are payment up front, so I use the template when producing quotes to the customer can pay based on the info in the quote.

However, what you’re mentioned is new to me, so I’ll check it out…If I was to use custom field in the sales invoice, can I put formatted HTML in there or does it have to be plain text?

plain text will be ok. you can set it as a paragraph.
you can put formatted html too but it may get complicated at times.

I’ll look into these suggestions. But if this extra detail is appearing in the preview but not the PDF that’s produced, could that suggest a bug in the PDF rendering?

No. the custom code you created would be outside the actual HTML table. in this case it will show in the preview but not when creating pdf.

Thanks, so does this mean I just need to nest the code within the table, adjust the placement for formatting purposes and I should get it displaying properly?

@zoog, this is the kind of information meant to go into the Notes field or Business Details. A template will apply this information to every form you generate, including invoices, receipts, journal entries, quotes, production orders, and everything else.