checkMinimal working example Printformat

Get to know how Betterprint works with this minimal example Printformat which includes helpful comments in order to understand how Betterprint should be used best.

{# Let's first add a header. In order to accomplish this, #}
{# we simply need to wrap our header with the paginate element #}
<paginate-source data-key="header">
    <img class="logo" src="https://fastly.picsum.photos/id/870/700/300.jpg?blur=2&grayscale&hmac=LQj4SmpDtFvU9sCkzydU_qHD7snZH8XAJ6s1pLGhZLo">
    <h1 class="title">{{doc.name}}</h1>
</paginate-source>


{# Let's add a footer too. Just replace the data-key with footer #}
<paginate-source data-key="footer">
    <p>
        My Test Company<br>
        Street 1<br>
        2332 Test<br>
        TAX-232323343434
    </p>
</paginate-source>


{# Add content as easy as this. Note: Betterprint adds them automatically. #}
<table class="item-table">
    <thead>
        <tr>
            <th style="width: 1cm">#</th>
            <th>Item</th>
            <th style="width: 1.5cm">Qty</th>
            <th style="width: 2cm">Rate</th>
            <th style="width: 2cm">Amount</th>
        </tr>
    </thead>
    <tbody>
        {% for row in doc.items %}
        <tr>
            <td>{{ row.idx }}</td>
            <td>
                <b>{{ row.item_name }}</b><br>
                {{ row.description }}
            </td>
            <td>{{ row.qty }} {{ row.uom or row.stock_uom }}</td>
            <td>{{ row.get_formatted("rate", doc) }}</td>
            <td>{{ row.get_formatted("amount", doc) }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

Final Result

The final Page layout will look something like this (click to zoom).

Last updated