Remove the Gaps Between the Item Labels When Printing on Advanced PDF/HTML Template

There is a requirement to print Item Labels using Advanced PDF/HTML Templates, the labels are being printed by 3’s with large gaps in between. To minimize the gaps, an adjustment to the Item Label Template should be done. Solution Navigate to Customization > Forms > Advanced PDF/HTML Templates Click Edit beside the preferred Item Label PDF/HTML Template Top right corner: Toggle Source Code Remove the… Continue reading Remove the Gaps Between the Item Labels When Printing on Advanced PDF/HTML Template

Different ways to Concatenate Strings in free Marker

We can achieve this by using + operator OR without operator Without + operator <#assign s = “Hello ${user}!”> ${s} Using + operator <#assign s = “Hello ” + user + “!”> Note : Assume that user is “Big Joe”. In both cases the output will be Hello Big Joe!

To remove all intervening line breaks in a template

Use <@compress single_line=true>…</@compress>  It aggressively removes indentations, empty lines and repeated spaces/tabs . Example: <@compress single_line=true> <#assign users = [{“name”:”Joe”, “hidden”:false}, {“name”:”James Bond”, “hidden”:true}, {“name”:”Julia”, “hidden”:false}]> List of users: <#list users as user> <#if !user.hidden> – ${user.name} </#if> </#list> That’s all. </#compress> OUTPUT List of users: – Joe – Julia That’s all.

Insert another FreeMarker template file into your template.

You can achieve this by using include. Syntax <#include path> or <#include path options> path: The path of the file to include; an expression that evaluates to a string. (With other words, it doesn’t have to be a fixed string, it can also be something like, for example, profile.baseDir + “/menu.ftl”.). Example: Assume /common/copyright.ftl contains: Copyright… Continue reading Insert another FreeMarker template file into your template.

Resolve Error: “Error Parsing XML: The entity name must immediately follow the ‘&’ in the entity reference”

This issue is normally seen in PDF and XML file of the pdf template which are rendered through script. This happens when our data contains ‘&’. ‘&’ are not supported in pdf and xml. Instead need to use ‘&amp;’ Solution This can be resolved by using replace() function Example: If you are updating Advanced PDF… Continue reading Resolve Error: “Error Parsing XML: The entity name must immediately follow the ‘&’ in the entity reference”

Change the page size on advanced PDF Template

There will be scenarios that smaller page size for taking the print. For example: PDF like item label, shipping label can have smaller pager size. Solutions Navigate to Customization > Forms > Advanced PDF/HTML Templates Preferred Advanced PDF/HTML Template: Click Edit Top Right Corner: Toggle Source Code Source Code: Locate the code below from the PDF source code<body header=”nlheader” header-height=”10%” footer=”nlfooter” footer-height=”10pt”padding=”0.5in 0.5in 0.5in 0.5in”… Continue reading Change the page size on advanced PDF Template