Integrating ZPL Files

Has anyone had any success integrating ZPL files and Retool?

I have a RESTApi Query set up that successfully posts uploaded ZPL files but trying to work out if there is a way to create a ZPL template, hold it in Retool somehow, and dynamically map values to it...and then post that.


I've tried doing this by placing the ZPL code in a text box and then mapping values into there.

The mapped values show in the text box but I'm having difficulty in passing the contents of the text box as the body of the API query. Maybe that's not doable?

I think I've solved this.

I had to Base64 encode the text field (that included the ZPL code) in a transformer block and add some other meta data around it but it seems to work...

Encoding it as base64 is indeed the way to do this. Otherwise it’s being sent as a string and the printer doesn’t know what tondo with it.
I’ve got it working the same way, but didn’t use a transformer, just a js query that triggers the api.


I just configure JSprintManager with retool just now.
In app scripts and styles section write

// start websocket
JSPM.JSPrintManager.auto_reconnect = true;

add library to it

In Query
write something like

var cpj = new JSPM.ClientPrintJob();
// you can use `JSPM.JSPrintManager.getPrinters();` in script query to get all printers list to append it to listbox.
cpj.clientPrinter = new JSPM.InstalledPrinter(listbox1.selectedItem);
cpj.printerCommands = `
         ^FO50,60^A0,40^FDWorld's Best Griddle^FS
// So excited, you can add callback to finsished event
cpj.onFinished = function(data) {

Don't forget to install JSPrintManager Client for different OS.
It's not free, but you can use all function only with a popup everytime you print.