I want to generate a barcode in svg from a barcode xml. I have followed this: http://barcode4j.sourceforge.net/2.1/barcode-xml.html
The input should be a configuration object created out of an xml file. The "cfgFile"[barcode.xml] file is of the following format:
<bc:barcode xmlns:bc="http://barcode4j.krysalis.org/ns" orientation="0" message="123456789">
<bc:code39>
<bc:height>15mm</bc:height>
<bc:module-width>0.19mm</bc:module-width>
<bc:wide-factor>2.5</bc:wide-factor>
</bc:code39>
</bc:barcode>
When I try to send this as input to Barcode 4j:
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
File cfgFile = new File("barcode.xml");
Configuration cfgnew = builder.buildFromFile(cfgFile);
DocumentFragment frag =
BarcodeUtil.getInstance().generateSVGBarcode(cfgnew, "123456789");
I get the following error:
Caused by: org.krysalis.barcode4j.BarcodeException: No barcode configuration element not found
at org.krysalis.barcode4j.BarcodeUtil.createBarcodeGenerator(Unknown Source) ~[Barcode4J-2.1.jar:?]
at org.krysalis.barcode4j.BarcodeUtil.createBarcodeGenerator(Unknown Source) ~[Barcode4J-2.1.jar:?]
at org.krysalis.barcode4j.BarcodeUtil.generateSVGBarcode(Unknown Source) ~[Barcode4J-2.1.jar:?
When I print a logger for cfgnew, I get this: bc:barcode:::@file