In the NetSuite advanced PDF template, barcode type GS1-128 is not supported in the <barcode> tag. However, we can usually achieve it by setting the codetype “code128” and setting the value according to the GS1-128 format. But if the GS1-128 barcode we need to create needs a Group separator, we wouldn’t be able to create the correct barcode using this method.
In this scenario, we need to create the barcode externally and then embed it in the Adavce PDF template using the <img > tag.
We can use the external library to create the barcode with Strict GS1-128 compliance.
The git library bwip-js provides online APIs for the GS1-128 barcode generation. So we can directly use this URL in the Advanced PDF template.
Reference: Online Barcode API ยท metafloor/bwip-js Wiki
Code sample:
<img src="http://bwipjs-api.metafloor.com/?bcid=gs1-128&text=(400)test1237(90)IF715" width="250" height="30"/>
Here in the URL, we can specify the barcode type in the “bcid” parameter and barcode value in the “text” parameter.
We can test the generated barcode in an online Barcode decoder to verify whether the barcode is generated correctly or not.