What is FreeMarker?

FreeMarker is a template engine built on Java that can be used to create powerful PDF templates in NetSuite. Many NetSuite aficionados are familiar with adjusting some basic elements on a NetSuite PDF template. But there are many who are unaware of what lies behind the “Source Code” toggle. In this brief blog post, I will attempt to describe what’s inside this Narnia’s closet.

NetSuite uses a number of different coding languages to accomplish different tasks. For SuiteScript, the essential language used is JavaScript. Searches can be improved with a bit of SQL, and Templates can be created using XML and FreeMarker. XML defines what you see on the Template, while FreeMarker is an extra brain we can use if we choose to.

FreeMarker is based on Java and is relatively simple to understand once you know a few basics.

FreeMarker Tidbits

Here’s a brief look at some of the syntax. Even if you are unfamiliar with coding, it may prove helpful to recognize what this tool is capable of.

“If statements” look something like,

<#if record.someField?has_content> 
    Show Something Here 
    Show Something Else Here 

Here, we are checking if a field on the record (e.g., Sales Order record) has a value. If it does, the PDF will show something in that case. If the field does not have a value, the PDF will show something else then.

When we simply need to reference a NetSuite field without an “If Statement,” we must use the special call (${}) before referencing the field:

The useful information you need is ${record.someUsefulField}

To read more about FreeMarker and see what it can do, hop over to their website here.

What Can We Do With FreeMarker?

With FreeMarker, we can do pretty much anything that you could need in a PDF. Need to show a field value on your printout? Check. Need to show a table with important information, display certain information when a criteria is met, or even perform currency calculations within the template? We can do that too!


FreeMarker is a powerful tool for NetSuite PDF templates! They enable us to design truly dynamic PDFs suitable for a variety of business needs. If you would like help with improving your company’s PDF templates, reach out to us for a free consultation!