| | |
| | | public class BarCodeUtils { |
| | | |
| | | /** |
| | | * 默认图片宽度 |
| | | * 默认图片宽度模 70MM |
| | | */ |
| | | private static final int DEFAULT_PICTURE_WIDTH = 300; |
| | | private static final int DEFAULT_PICTURE_WIDTH = 260; |
| | | |
| | | /** |
| | | * 默认图片高度 |
| | | * 默认图片高度 50MM |
| | | */ |
| | | private static final int DEFAULT_PICTURE_HEIGHT = 200; |
| | | private static final int DEFAULT_PICTURE_HEIGHT = 185; |
| | | |
| | | /** |
| | | * 默认条形码宽度 |
| | | */ |
| | | private static final int DEFAULT_BAR_CODE_WIDTH = 295; |
| | | private static final int DEFAULT_BAR_CODE_WIDTH = 250; |
| | | |
| | | /** |
| | | * 默认条形码高度 |
| | |
| | | |
| | | public static String getBarCodeImageBase64(String codeValue, String bottomStr1, String bottomStr2, String bottomStr3) { |
| | | BufferedImage image = getBarCodeWithWords(codeValue, bottomStr1, bottomStr2, bottomStr3); |
| | | |
| | | try{ |
| | | ImageIO.write(image, "jpg", new File("D:/IGDS/TEMP/BR_CODE_T.jpg")); |
| | | }catch(Exception e){ |
| | | |
| | | } |
| | | return GetBase64FromImage(image); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | BufferedImage image = BarCodeUtils.getBarCodeWithWords("C_202306290005", "202306290005", "中心粮库", "2023-06-29 12:25"); |
| | | BufferedImage image = BarCodeUtils.getBarCodeWithWords("R_202306290005", "202306290005", "样品质检码", "2023-06-29 12:25"); |
| | | ImageIO.write(image, "jpg", new File("D:/IGDS/TEMP/BR_CODE_T.jpg")); |
| | | } |
| | | } |