Problem is i need to use utf-8 chars in datamatrix. Any chance to add utf-8 characters to the datamatrix? I know about extensions like ECI = 22 for adding UTF-8, but how to realize this? Maybe with itextpdf.barcodes.BarcodeDataMatrix i can do this, but i don't find examples.
I found the solution with okapibarcode ( https://github.com/woo-j/OkapiBarcode )
uk.org.okapibarcode.backend.DataMatrix dataMatrix = new uk.org.okapibarcode.backend.DataMatrix();
dataMatrix.setFontName("Helvetica");
dataMatrix.setFontSize(11);
dataMatrix.setModuleWidth(2);
dataMatrix.setBarHeight(50);
dataMatrix.setContent("тест");
int width = dataMatrix.getWidth();
int height = dataMatrix.getHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
Graphics2D g2d = image.createGraphics();
Java2DRenderer renderer = new Java2DRenderer(g2d, 1, Color.WHITE, Color.BLACK);
renderer.render(dataMatrix);
return image;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.