|
|
|
@ -2,7 +2,6 @@ package org.xbib.graphics.barcode.render;
|
|
|
|
|
|
|
|
|
|
import org.xbib.graphics.zxing.BarcodeFormat;
|
|
|
|
|
import org.xbib.graphics.zxing.MultiFormatWriter;
|
|
|
|
|
import org.xbib.graphics.zxing.NotFoundException;
|
|
|
|
|
import org.xbib.graphics.zxing.WriterException;
|
|
|
|
|
import org.xbib.graphics.zxing.common.BitMatrix;
|
|
|
|
|
|
|
|
|
@ -17,21 +16,33 @@ public class Code39Writer {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void write(String content, Path path, String format, int width, int height)
|
|
|
|
|
throws WriterException, IOException, NotFoundException {
|
|
|
|
|
BitMatrix matrix = new MultiFormatWriter().encode(content, BarcodeFormat.CODE_39, width, height);
|
|
|
|
|
MatrixToImageWriter.writeToPath(matrix, format, path);
|
|
|
|
|
throws IOException {
|
|
|
|
|
try {
|
|
|
|
|
BitMatrix matrix = new MultiFormatWriter().encode(content, BarcodeFormat.CODE_39, width, height);
|
|
|
|
|
MatrixToImageWriter.writeToPath(matrix, format, path);
|
|
|
|
|
} catch (WriterException e) {
|
|
|
|
|
throw new IOException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void write(String content, OutputStream outputStream, String format, int width, int height)
|
|
|
|
|
throws WriterException, IOException, NotFoundException {
|
|
|
|
|
BitMatrix matrix = new MultiFormatWriter().encode(content, BarcodeFormat.CODE_39, width, height);
|
|
|
|
|
MatrixToImageWriter.writeToStream(matrix, format, outputStream);
|
|
|
|
|
throws IOException {
|
|
|
|
|
try {
|
|
|
|
|
BitMatrix matrix = new MultiFormatWriter().encode(content, BarcodeFormat.CODE_39, width, height);
|
|
|
|
|
MatrixToImageWriter.writeToStream(matrix, format, outputStream);
|
|
|
|
|
} catch (WriterException e) {
|
|
|
|
|
throw new IOException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BufferedImage write(String content, int width, int height)
|
|
|
|
|
throws WriterException, IOException, NotFoundException {
|
|
|
|
|
BitMatrix matrix = new MultiFormatWriter().encode(content, BarcodeFormat.CODE_39, width, height);
|
|
|
|
|
return MatrixToImageWriter.toBufferedImage(matrix);
|
|
|
|
|
throws IOException {
|
|
|
|
|
try {
|
|
|
|
|
BitMatrix matrix = new MultiFormatWriter().encode(content, BarcodeFormat.CODE_39, width, height);
|
|
|
|
|
return MatrixToImageWriter.toBufferedImage(matrix);
|
|
|
|
|
} catch (WriterException e) {
|
|
|
|
|
throw new IOException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|