Print shipping label on Zebra Label printer from ZOHO Creator deluge
Hi All,
Allow me to guide you through the process of printing a shipping label from ZOHO Creator to a Zebra label printer (ZD421D).
Step 1:
To start, configure the SendFileToPrinter API, which enables the transmission of a file to a Zebra Link-OS printer. Access this API within the Data Service Section of the Zebra Developer Portal. If you haven't already, create a free account on the portal to proceed with the configuration of the API.
Step 2:
Next, set up the invokeurl API within ZOHO Creator's deluge environment.
For label creation, I utilized basic ZPL code to generate the label, which is then converted into a text file and sent to the printer. Use
https://labelary.com/ for easy label reation.
//Minor example of ZPL Code
varZPLData="^XA^FO50,50^A0N,50,50^FDHello,World!^FS^XZ";^XA^FO50,50^A0N,50,50^FDHello, World!^FS^XZzplFile = varZPLData.tofile("Label.zpl");
// Construct the URL and headers for the Zebra SendFileToPrinter APIurl_value = "https://api.zebra.com/v2/devices/printers/send";headers_value = Map();headers_value.put("apikey","9...FF"); //From Zebra Developer Portalheaders_value.put("tenant","6...99"); //From Zebra Developer Portal// Create the multipart form data body// Set the printer serial number// Use the downloaded file as zpl_fileparameters = Map();parameters.put("sn","D...5");//From Zebra Developer Portalparameters.put("zpl_file",zplFile);// Send the request to Zebra SendFileToPrinter APIresponse = invokeurl[ url :url_value type :POST parameters:parameters headers:headers_value detailed:true content-type:"multipart/form-data"];
Hope it helps you!