Integrating a Bar code generation functionality into an advanced PDF template.

The below provided HTML code is aimed at integrating a Bar code generation functionality into an advanced PDF template.

<td border="1.5" style="width:60%;border-color: rgb(0,0,0);">
<#if record.custbody_if_parent_waybill_no?has_content>
                                   <barcode codetype="code128" showtext="true" width="200px" height="45px" value=" Master AWB - ${record.custbody_if_parent_waybill_no}"/>
                                  </#if></td>
  1. Condition (<#if record.custbody_if_parent_waybill_no?has_content>):
    • This line initiates a conditional check using the FreeMarker templating language.
    • It checks if the “custbody_if_parent_waybill_no” field of a record has content.
  2. Barcode Generation (<barcode>):
    • If the condition is met (i.e., “custbody_if_parent_waybill_no” has content), a Code 128 barcode is generated using the <barcode> tag.
    • The codetype="code128" attribute specifies the type of the barcode as Code 128.
    • showtext="true" indicates that the human-readable text associated with the barcode should be displayed.
    • width="200px" and height="45px" set the dimensions of the barcode.
    • The value=" Master AWB - ${record.custbody_if_parent_waybill_no}" attribute sets the content of the barcode, which includes the prefix “Master AWB -” followed by the content of the “custbody_if_parent_waybill_no” field from the record.

Overall, this code snippet creates a Code 128 barcode with a specific format and content based on the “custbody_if_parent_waybill_no” field of a record, enhancing the representation of information within the PDF template.

The generated barcode will be like this.

Leave a comment

Your email address will not be published. Required fields are marked *