Best Practices In Advanced PDF Template

  • To Handle the Header and Body content Overlapping issue

To Handle the Header and Body content Overlapping issue to include all header content in the Body table as header data. Refer the following sample

<body header="nlheader" header-height="8%" footer="nlfooter" footer-height="56pt" padding="0.3in 0.3in 0.3in 0.3in" size="A5">
<table style="width: 100%; font-size: 10pt;" colspan="25">
<thead>
<!-- Add the Header Contents-->
</thead>
<tbody>
<!-- Add the Body Contents-->
</tbody>
</table>
</body>
  • To Handle Unwanted space when data in the column is increased

If the row contains multiples columns as follow

There is chance to generate unwanted space on the right side columns If the left side column has more data.

In such cases needs to handle columns as separate table. That is in each column data added inside another table content. Refer the following Code;

           <tr>
              <td>
                <table style="width:100%;">
                  <!-- Add the contents here -->
                </table>
              </td>
              <td>
                <table style="width:100%;">
                  <!-- Add the contents here -->
                </table>
              </td>

              <td>
                <table style="width:100%;">
                  <!-- Add the contents here -->
                </table>
              </td>
            </tr>
  • To Set the Amount in the comma Separated format , Include the following function in the Advanced PDF Template
       <#function toCurrency value showSymbol=false>
          <#if value?is_number>
          <#local retval = 0>
          <#local retval = value?string["#,##0.00"]>
		 
          <#return retval>
          <#else>
          <#return value>
          </#if>
        </#function>
<tr><td align="center" class="fontClass"  colspan="5" style="border-top:1px;border-bottom:1px;">${toCurrency(totalAmount)}</td></tr>
  • Sort the Item table content in the PDF Print
<#list record.item?sort_by("item") as item></#list>
  • Display the first line item Content in Advanced PDF
<#list record.item as item>
   <#if item?counter == 1><!--contents--></#if>                 
</#list>

Leave a comment

Your email address will not be published. Required fields are marked *