Class BarcodeUtil
java.lang.Object
org.summerboot.jexpress.util.barcode.BarcodeUtil
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final Map<com.google.zxing.EncodeHintType,?> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]buildPDF417PNG(byte[] dataToEncode, int width, int height) static byte[]buildPDF417PNG(String contents, int width, int height) static byte[]buildPDF417PNG(String contents, int width, int height, Map hints) static com.google.zxing.common.BitMatrixgenerateBarcode(String barcodeText, com.google.zxing.BarcodeFormat format, int widthPixels, int heightPixels, Map<com.google.zxing.EncodeHintType, ?> cfg) static com.google.zxing.common.BitMatrixgenerateBarcode(String barcodeText, com.google.zxing.Writer writer, com.google.zxing.BarcodeFormat format, int widthPixels, int heightPixels, Map<com.google.zxing.EncodeHintType, ?> cfg) static StringgenerateBase64Image(String barcodeText, com.google.zxing.BarcodeFormat barcodeFormat, int widthPixels, int heightPixels, Map<com.google.zxing.EncodeHintType, ?> cfg, String imageFormat, int onColor, int offColor) Useage in HTML <img src="data:image/png;base64,${barcode image string}" alt="barcode" />.static BufferedImagetoBufferedImage(com.google.zxing.common.BitMatrix matrix, int onColor, int offColor) static byte[]toByteArray(com.google.zxing.common.BitMatrix matrix, String imageFormat, int onColor, int offColor)
-
Field Details
-
ARGB_BLACK
public static final int ARGB_BLACK- See Also:
-
ARGB_WHITE
public static final int ARGB_WHITE- See Also:
-
ARGB_TRANSPARENT
public static final int ARGB_TRANSPARENT- See Also:
-
DEFAULT_COFNIG
-
-
Constructor Details
-
BarcodeUtil
public BarcodeUtil()
-
-
Method Details
-
generateBase64Image
public static String generateBase64Image(String barcodeText, com.google.zxing.BarcodeFormat barcodeFormat, int widthPixels, int heightPixels, Map<com.google.zxing.EncodeHintType, ?> cfg, String imageFormat, int onColor, int offColor) throws IOExceptionUseage in HTML <img src="data:image/png;base64,${barcode image string}" alt="barcode" />.- Parameters:
barcodeText-barcodeFormat-widthPixels-heightPixels-cfg-imageFormat- png, jpg, etc.onColor- ARGBoffColor- ARGB- Returns:
- Throws:
IOException
-
generateBarcode
public static com.google.zxing.common.BitMatrix generateBarcode(String barcodeText, com.google.zxing.BarcodeFormat format, int widthPixels, int heightPixels, Map<com.google.zxing.EncodeHintType, ?> cfg) throws IOException- Throws:
IOException
-
generateBarcode
public static com.google.zxing.common.BitMatrix generateBarcode(String barcodeText, com.google.zxing.Writer writer, com.google.zxing.BarcodeFormat format, int widthPixels, int heightPixels, Map<com.google.zxing.EncodeHintType, ?> cfg) throws IOException- Throws:
IOException
-
toByteArray
public static byte[] toByteArray(com.google.zxing.common.BitMatrix matrix, String imageFormat, int onColor, int offColor) throws IOException - Parameters:
matrix-imageFormat- pngonColor- ARGBoffColor- ARGB- Returns:
- Throws:
IOException
-
toBufferedImage
public static BufferedImage toBufferedImage(com.google.zxing.common.BitMatrix matrix, int onColor, int offColor) -
buildPDF417PNG
- Throws:
IOException
-
buildPDF417PNG
- Throws:
IOException
-
buildPDF417PNG
public static byte[] buildPDF417PNG(String contents, int width, int height, Map hints) throws IOException - Throws:
IOException
-