Based on the content length we can adjust the header height. This will be helpful in label creation using advanced PDF template. Code is provided below:
<#assign headerHeight = "35%"> <!-- Default header height -->
<#assign content = record.otherrefnum> <!-- assigning the field to the variable content-->
<#assign contentLength = content?length> <!-- getting the length of content and assigned to the variable contentlength-->
<#if contentLength = 0>
<#assign headerHeight = "27%">
<#elseif contentLength lt 20>
<#assign headerHeight = "35%">
<#elseif contentLength lt 40>
<#assign headerHeight = "43%">
<#elseif contentLength gt 40>
<#assign headerHeight = "51%">
</#if>
<body header="nlheader" header-height= "${headerHeight}" footer="nlfooter" footer-height="88pt" padding="0.2in 0.2in 0.2in 0.2in" width="4in" height="6in">