250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- spring
- jpa
- AJAX
- Core Java
- MSSQL
- Python
- 문서
- JavaScript
- JDBC
- SpringBoot
- git
- STS
- Eclipse
- 오픈소스
- IntelliJ
- Tomcat
- myBatis
- maven
- PostgreSQL
- MySQL
- Exception
- Spring Boot
- ubuntu
- Source
- Docker
- Thymeleaf
- error
- 설정
- oracle
- Open Source
Archives
- Today
- Total
헤르메스 LIFE
[Core Java] QRCode 출력 본문
728x90
자바를 이용한 이미지로 바코드 출력 소스로, 사용자가 원하는 이미지 TYPE과 SIZE를 정의 출력하여, PDF출력이나 엑셀출력시 클래스를 불러와 라벨작업에 활용가능하다.
mport java.io.File;
import java.io.FileOutputStream;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
//import com.google.zxing.oned.Code39Writer;
import com.google.zxing.qrcode.QRCodeWriter;
public class Qrcode {
public static void main(String[] args) {
QRCodeWriter q = new QRCodeWriter();
//Code39Writer q = new Code39Writer();
try {
String text = "http://neosm.com";
text = new String(text.getBytes("UTF-8"), "ISO-8859-1");
BitMatrix bitMatrix = q.encode(text, BarcodeFormat.QR_CODE,200,200);
MatrixToImageWriter.writeToStream(bitMatrix, "png",
new FileOutputStream(new File("neosm.png")));
} catch (Exception e) {
e.printStackTrace();
}
}
}
출처 : TokyoAJ :: [JAVA] QRCode 출력 및 바코드 출력 (tistory.com)
[JAVA] QRCode 출력 및 바코드 출력
자바를 이용한 이미지로 바코드 출력 소스로, 사용자가 원하는 이미지 TYPE과 SIZE를 정의 출력하여, PDF출력이나 엑셀출력시 클래스를 불러와 라벨작업에 활용가능하다. import java.io.File; import ja
neosm.tistory.com
728x90
'Core Java' 카테고리의 다른 글
[Core Java] File List 떨구는 샘플 (0) | 2021.03.23 |
---|---|
[Core Java] 외부명령 실행하기 (0) | 2021.03.23 |
[Core Java] HTML entity 코드 변환 (0) | 2021.03.23 |
한글 Encoding 확인 (0) | 2021.02.08 |
[Jackson] ObjectMapper, String to Map, to List, Object to JSON (0) | 2021.01.31 |