Now that you’ve learned the fundamentals of Advanced PDF (FreeMarker, conditional logic, CSS styling, custom fields, and multi-subsidiary support), let’s put it all together with complete real-world examples.
These templates are ready-to-use samples that you can copy, adapt, and apply in your NetSuite account.
🔹 Example 1: Invoice Template (With Logo, Header & Table)
<!-- Company Logo -->
<div style="text-align:center;">
<img src="${record.logo}" width="200"/>
</div>
<!-- Header Info -->
<h2 style="text-align:center;">Invoice</h2>
<p><b>Invoice #:</b> ${record.tranid}</p>
<p><b>Date:</b> ${record.trandate?string("MMMM dd, yyyy")}</p>
<p><b>Customer:</b> ${record.entity}</p>
<!-- Line Item Table -->
<table width="100%" style="border-collapse: collapse; font-size:12px; margin-top:15px;">
<tr style="background:#f2f2f2; font-weight:bold;">
<th style="border:1px solid #ccc; padding:5px;">Item</th>
<th style="border:1px solid #ccc; padding:5px;">Qty</th>
<th style="border:1px solid #ccc; padding:5px; text-align:right;">Rate</th>
<th style="border:1px solid #ccc; padding:5px; text-align:right;">Amount</th>
</tr>
<#list record.item as i>
<tr <#if i_index % 2 == 0>style="background:#f9f9f9;"</#if>>
<td style="border:1px solid #ddd; padding:5px;">${i.item}</td>
<td style="border:1px solid #ddd; padding:5px; text-align:center;">${i.quantity}</td>
<td style="border:1px solid #ddd; padding:5px; text-align:right;">${i.rate?string["#,##0.00"]}</td>
<td style="border:1px solid #ddd; padding:5px; text-align:right;">${i.amount?string["#,##0.00"]}</td>
</tr>
</#list>
</table>
<!-- Total -->
<p style="text-align:right; font-size:14px; font-weight:bold; margin-top:10px;">
Total Due: ${record.total?string["#,##0.00"]} ${record.currency}
</p>
🔹 Example 2: Sales Order with Conditional Shipping Terms
<h2>Sales Order</h2>
<p><b>Order #:</b> ${record.tranid}</p>
<p><b>Date:</b> ${record.trandate?string("dd-MMM-yyyy")}</p>
<p><b>Customer:</b> ${record.entity}</p>
<#if record.shipmethod?has_content>
<p><b>Shipping Method:</b> ${record.shipmethod@label}</p>
</#if>
<#if record.terms?has_content>
<p><b>Payment Terms:</b> ${record.terms@label}</p>
<#else>
<p><b>Payment Terms:</b> Prepaid</p>
</#if>
✔️ Dynamic shipping method and payment terms.
🔹 Example 3: Multi-Subsidiary Statement Footer
<#switch record.subsidiary>
<#case "1">
<p style="font-size:11px; text-align:center; margin-top:20px;">
© ${.now?string("yyyy")} UK Subsidiary Ltd. VAT: GB123456789
</p>
<#break>
<#case "2">
<p style="font-size:11px; text-align:center; margin-top:20px;">
© ${.now?string("yyyy")} Canada Subsidiary Inc. GST/HST: 789456123RT0001
</p>
<#break>
<#default>
<p style="font-size:11px; text-align:center; margin-top:20px;">
© ${.now?string("yyyy")} ${record.companyname}
</p>
</#switch>
✔️ Prints different footer text based on subsidiary.
🔹 Example 4: Highlight High-Value Orders
<#list record.item as i>
<tr <#if i.amount?number > 5000>style="background:#ffe6e6;"</#if>>
<td>${i.item}</td>
<td>${i.description}</td>
<td>${i.quantity}</td>
<td style="text-align:right;">${i.rate?string["#,##0.00"]}</td>
<td style="text-align:right;">${i.amount?string["#,##0.00"]}</td>
</tr>
</#list>
✔️ Highlights rows where line amount exceeds 5,000.
🔹 Example 5: Custom Fields Section
<#if record.custbody_project_code?has_content>
<p><b>Project Code:</b> ${record.custbody_project_code}</p>
</#if>
<#if record.custbody_delivery_note?has_content>
<p><b>Delivery Note:</b> ${record.custbody_delivery_note}</p>
</#if>
✔️ Displays custom body fields only when values exist.
✅ Best Practices
- Always clone and test before applying to production.
- Use inline CSS for better compatibility.
- Keep tables clean and consistent.
- Validate each section step by step to avoid crashes.
- Make templates modular (header, body, footer sections).
✅ Summary — What You Learned
By the end of this page, you now have complete Advanced PDF examples for:
- ✅ A full Invoice layout with logo, header, line items, and totals
- ✅ A Sales Order template with conditional terms
- ✅ A Statement footer that changes by subsidiary
- ✅ A Line item table with conditional highlights
- ✅ A Custom field section for project codes and notes
With these, you can create professional, branded, and dynamic PDFs in NetSuite.
Leave a Reply