The following FreeMarker code can be used in an Advanced PDF/HTML template to retrieve and display values from a linked custom record on the invoice PDF.
<#assign customRecord = record.custbody6>
<#-- Fetch the value from the custom record -->
<#assign customFieldValue = customRecord.custrecord126>
<table style="width: 100%; margin-top: 10px;">
<tr><td class="addressheader" colspan="3"><b>Subsidiary Bank Account Details</b></td></tr>
<tr> <td><b>Bank Name:</b> ${record.custbody6}</td> <td><b>Bank Account:</b> ${customFieldValue}</td></tr>
</table>