BackEND/Java

바코드 구현

mingmingIT 2017. 11. 30. 11:56

**저장되있는 숫자로 바코드 만들기


ZXing.jar 가 필요하다.


MultiFormatWriter multi = new MultiFormatWriter();
try {
     String text = "9788996454816";
     text = new String(text.getBytes("UTF-8"), "ISO-8859-1");
     BitMatrix bitMatrix = multi.encode(text, BarcodeFormat.EAN_13, 100, 100);
     MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new     File("D:/file/"+text+".png")));
} catch (Exception e) {
e.printStackTrace();

}


'BackEND > Java' 카테고리의 다른 글

utc 날짜 파싱하는 방법  (0) 2019.05.03
자주 쓰는 형변환 정리  (0) 2017.11.30
UTC 날짜 파싱  (0) 2017.11.30
배열을 jsonString 형식으로 변환  (0) 2017.11.30
mac 주소 가져오기.  (0) 2017.11.30