• : 1-877-596-8218
  • : sales@aecc.ca
# # #

How to create .zpl extension file to print custom Shipping Labels directly to a Zebra printer

Recently I worked on ShippingLabel customization for one of our customers. The requirement was to create a .zplfile that can be printed directly to Zebra printer in the Warehouse.Now the ‘N/Render’ moduleencapsulates functionality for printing, PDF creation, form creation from templates, and email creation from templates. But how to utilize the same to create a .zpl file for custom Shipping Labels?


  •    SuiteScript 2.0
  •    Knowledge of Freemarker Template Language Reference
  •    A little knowledge of Zebra Programming Language Instructions


AZPL file is the printer format that basically contains instructions in Zebra Programming Language. A reference file can be downloaded using Netsuite’s integrated Shipping Label functionality. It can be then be converted into .txt extension and kept inside Netsuite File Cabinet.

The .txt file can be customized to add Freemarker expressions to build the Shipping Label data template.

A render object is created inside a Suitelet using ‘N/Render’ moduleand .txt file content can be assigned to it using render object memberrenderObj.templateContent.Finally,renderObj.renderAsString returns the template content in string form which can eventually be returned as a response file with .zpl extension.

//Example (SuiteScript 2.0)

//Script type: Suitelet

//Load .txt file from file cabinet
var txtFile = file.load({
  id: fileId,

//create a render object
var renderObj = render.create();

//Add netsuite record data to build custom label template
  templateName: 'record',
  record: item_fulfillment,

//Get the content from .txt File
renderObj.templateContent = txtFile.getContents();

//To return the template content in string form
var ShippingLabelData = renderObj.renderAsString();

//Create a file with .zpl extension
var zplFileObj = file.create({
  name: 'ShippingLabel.zpl',
  fileType: file.Type.PLAINTEXT,
  encoding: file.Encoding.UTF8,
  isOnline: true,
  contents: shippingLabelData,

//Add the result file to the suitelet response
context.response.writeFile(zplFileObj, false);