Scenario
User needs to print a Sales Order however when attempting to do so, error occurs which states the following:
"The template cannot be printed due to the following errors: Error on line XXX, column X in template. Detail... Syntax error in template "template" in line XXX, column X: Unexpected end of file reached. You have an unclosed #if. Check if the FreeMarker end-tags are present, and aren't malformed. (Note that FreeMarker end-tags must have # or @ after the / character.) Please contact your administrator."
Solution
Based on the error, this is being caused by unclosed #if. To resolve the error, locate all of the IF Statement in the Advanced PDF/HTML Template and identify the one missing a closing IF tag.
On the following example, the statement missing the IF ending tag is Line 165.
With this, add </#if> in Line 188. This should resolve the error.