Free Support Forum - aspose.com

Aspose Java BarCodeGenerator method setCodeTextEncoding not available


#1

Hello,

I use the BarCodeGenerator class to generate a datamatrix barcode with encoding:
DataMatrixEncodeMode.CUSTOM

How can I set the CodeTextEncoding in UTF-8?

With the previously Java Barcode Library (now depracated class BarCodeBuilder) I used the method setCodeTextEncoding.

Thanks for your help.
Best regards,
Mathieu


#2

@fridollin,

Thank you for contacting Aspose Support.

Please use the code snippet given below to set CodeTextEncoding.

BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.DATA_MATRIX);
generator.setCodeText("Example");
generator.getD2().setCodeTextEncoding(Charset.forName("UTF-8"));
generator.save("Test.png");

We hope that this answered your question. Please feel free to reach us if additional information is required.