Scenario:
On printing values on a table, there are scenarios where the texts are lengthy and distorts the layout of the tables on the Advanced PDF template, and this is especially true for the item descriptions.
This article provides steps on limiting the Item Description length to print only up to 30 characters when it exceeds 30 characters when using Advanced PDF/HTML Template.
Solution:
- Navigate to Customization > Forms > Advanced PDF/HTML Templates
- Preferred Advanced PDF/HTML Template: Click Edit
- Upper Right Corner: Toggle Source Code
- Look for the code:
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
<td colspan="12"><span style="font-weight: bold; line-height: 150%; color: #333333;">${item.item}</span><br />${item.description}</td>
<td align="right" colspan="4">${item.rate}</td>
<td align="right" colspan="4">${item.amount}</td>
</tr>
5. Update the code to:
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
<td colspan="12"><span style="font-weight: bold; line-height: 150%; color: #333333;">${item.item}</span><br />
<#if item.description?length gte 30>
${item.description?substring(0,29)}
<#else>
${item.description}
</#if>
</td>
<td align="right" colspan="4">${item.rate}</td>
<td align="right" colspan="4">${item.amount}</td>
</tr>
6. Click Save