반응형
StringBuffer sb = new StringBuffer ();
sb.append ( "안녕하세욥" );
Map<EncodeHintType, Object> qrParam = new HashMap<EncodeHintType, Object> ();
qrParam.put ( EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M );
qrParam.put ( EncodeHintType.CHARACTER_SET, "UTF-8" );
BarcodeQRCode qrcode = new BarcodeQRCode ( sb.toString (), 33, 33, qrParam );
var a = qrcode.createAwtImage ( Color.BLACK, Color.WHITE );
var b = Image.getInstance(a, Color.BLACK);
var imgWidth = 400;
var imgHeight = 400;
PdfContentByte content = stamper.getOverContent(i);
var pageWidth = pdfReader.getPageSize(i).getWidth() - imgWidth;
var pageHeight = pdfReader.getPageSize(i).getHeight() - imgHeight;
PdfGState gs = new PdfGState();
content.setGState(gs);
b.setAbsolutePosition(pageWidth/2, pageHeight/2);
b.scaleAbsolute(imgWidth, imgHeight);
content.addImage(b);
반응형
'개발 > Spring' 카테고리의 다른 글
[Spring 실전] 2. 인증 (웹) (0) | 2025.06.19 |
---|---|
[Spring 실전] 1. 멀티모듈 (0) | 2025.06.18 |
[Swagger] Request가 Map인 경우 Controller 작성법 (0) | 2023.11.01 |
Querydsl 에서 datetime과 date 비교하기 (0) | 2023.07.10 |
Description 을 사용하자 (0) | 2023.06.20 |