I have a problem that has blocked me in my project for several weeks...

Let me explain, I have to translate an XML barcode into ZPL.

Problem : which ratio allows to know the width of the bar code in ZPL knowing that I have a width in cm in xml. Indeed the ^BY command only offers me the Width module with values between 1 and 10 so nothing really precise. Moreover I noticed that depending on the number of characters in the bar code it influences the width. So I would like to know if there is a conversion for the bar code width from cm to ZPL.

Unfortunately there is no way set the final barcode width ZPL. It does adjust to the amount of data you have. The width is a scale of the individual line or dot widths. The only way to do this is to use outside tools to convert the barcode into an image. Several of our design partners have this software that will scale to specific width requirements. The other way is to have your code change the width based on the amount of data dynamically, but that doesn't fit the XML framework you are using.