In NetSuite’s Advanced PDF/HTML templates, generating a QR code with multi-line information can enhance readability and organization of data, especially for users who need to display structured data fields like addresses. FreeMarker templates support adding line breaks in QR code data, which can make each piece of information appear on a new line when scanned. This article will guide you through using Unicode line feed characters to achieve this formatting within FreeMarker.
Adding Line Breaks with the Unicode Line Feed Character
To insert a new line within a QR code generated by FreeMarker, use the Unicode line feed character
. This character will add a line break between fields in the QR code, making it appear as if each field is on a separate line when scanned by most QR code readers.
Implementing Line Breaks in FreeMarker
Here’s a sample implementation of a QR code that includes line breaks between data fields:
<barcode codetype=”qrcode” height=”100px” width=”100px” showtext=”true”
value=”${record.entity}
${record.shipattention}
${record.shipaddr1}
${record.shipaddr2}
${record.shipcity}
${record.shipstate}
${record.shipzip}” />
Explanation
- : This is the Unicode character for a line feed, also known as a new line. Adding
-  between fields in the valueattribute of the<barcode>tag will separate the fields onto different lines within the QR code data.
- Field Layout: In this example, each field (record.entity,record.shipattention, etc.) will appear on a new line in the encoded QR code data. This approach allows each piece of information to be organized line-by-line for easier reading when scanned.
