Merge XML & ZPL template and print (to file)

// Expert user has replied.
Y Yanis Dalabiras 3 years 4 months ago
644 1 0

What i try to do is to merge an XML file with data and a ZPL file template (created with Zebra Designer for developers) to create a ready-to-print file (or directly print it).
I was using XMLPrinter class, because i thought it would generate a print file combining these 2. However, i discovered it does not do that, it generates a file which has to be send to the printer, where the template is being stored (it only converts the XML). Problem is that we need to work with USB connected printers, so no easy updating of the templates in the printer itself.
So, we would like to central store (and update) the ZPL templates, and use these in our software to combine them locally with an XML file and generate a printfile (ZPL) that is ready to print.
Is that possible with the SDK ? Or should we process the ZPL template with our own to write parser ?

Please Register or Login to post a reply

1 Replies

S Steven Si

I've not done that personally, but I think we can do that if we want to merge the ZPL template with the data from the XML on the application side. If we leave null for destinationDevice parameter in XmlPrinter.print() API, I think the merged content will be in the outputDataStream. Then the application can do another connection.write() to send the content in the outputDataStream to the printer. Give it a try. Hope it works.

CONTACT
Can’t find what you’re looking for?