• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
chominsoo4245 / mjon_git star
Forked from hylee / mjon_git
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
mjon_gitsrcmainjavaitncomcmmutilPdfUtil.java
Download as .zip file
File name
Commit message
Commit date
DATABASE
mjon_git
2023-06-12
src/main
IPIgnore Interceptor IPv4/IPv6 모두 체크되도록 기능 수정
2023-07-03
.codetogether.ignore
mjon_git
2023-06-12
.gitignore
gitignore 적용
2023-06-12
pom.xml
mjon_git
2023-06-12
File name
Commit message
Commit date
java
IPIgnore Interceptor IPv4/IPv6 모두 체크되도록 기능 수정
2023-07-03
resources
회원 탈퇴자 관리 통계 추가
2023-06-26
webapp
주소록 관리 문자 주소록 개별 등록시 핸드폰 및 일반전화 유효성 체크 스크립트 추가
2023-07-03
File name
Commit message
Commit date
egovframework
mjon_git
2023-06-12
itn
IPIgnore Interceptor IPv4/IPv6 모두 체크되도록 기능 수정
2023-07-03
File name
Commit message
Commit date
com
IPIgnore Interceptor IPv4/IPv6 모두 체크되도록 기능 수정
2023-07-03
let
알림톡 채널 생성일, 등록일 구분 추가
2023-06-30
web
전용계좌 첫결제시 스미싱알림 처리
2023-06-26
File name
Commit message
Commit date
api/web
mjon_git
2023-06-12
cmm
IPIgnore Interceptor IPv4/IPv6 모두 체크되도록 기능 수정
2023-07-03
sym/log/ulg
mjon_git
2023-06-12
usr/search/web
mjon_git
2023-06-12
uss
mjon_git
2023-06-12
utl
mjon_git
2023-06-12
File name
Commit message
Commit date
aspect
mjon_git
2023-06-12
captcha
mjon_git
2023-06-12
filter
mjon_git
2023-06-12
interceptor
IPIgnore Interceptor IPv4/IPv6 모두 체크되도록 기능 수정
2023-07-03
service
mjon_git
2023-06-12
taglibs
mjon_git
2023-06-12
util
mjon_git
2023-06-12
web
mjon_git
2023-06-12
AltibaseClobStringTypeHandler.java
mjon_git
2023-06-12
ComDefaultCodeVO.java
mjon_git
2023-06-12
ComDefaultVO.java
mjon_git
2023-06-12
EgovComCrossSiteHndlr.java
mjon_git
2023-06-12
EgovComExcepHndlr.java
mjon_git
2023-06-12
EgovComOthersExcepHndlr.java
mjon_git
2023-06-12
EgovComTraceHandler.java
mjon_git
2023-06-12
EgovMessageSource.java
mjon_git
2023-06-12
EgovMultiPartEmail.java
mjon_git
2023-06-12
EgovWebUtil.java
mjon_git
2023-06-12
ImagePaginationRenderer.java
mjon_git
2023-06-12
ImagePaginationRendererWeb.java
mjon_git
2023-06-12
JsonResult.java
mjon_git
2023-06-12
LoginVO.java
mjon_git
2023-06-12
ReadVO.java
mjon_git
2023-06-12
SessionVO.java
mjon_git
2023-06-12
UserVO.java
mjon_git
2023-06-12
File name
Commit message
Commit date
ContextUtil.java
mjon_git
2023-06-12
Criteria.java
mjon_git
2023-06-12
DateUtil.java
mjon_git
2023-06-12
EgovBasicLogger.java
mjon_git
2023-06-12
EgovDoubleSubmitHelper.java
mjon_git
2023-06-12
EgovResourceCloseHelper.java
mjon_git
2023-06-12
ExcelDownloadUtil.java
mjon_git
2023-06-12
ExcelUploadUtil.java
mjon_git
2023-06-12
FaxUtil.java
mjon_git
2023-06-12
FileUtil.java
mjon_git
2023-06-12
IpUtil.java
mjon_git
2023-06-12
MJUtil.java
mjon_git
2023-06-12
Order.java
mjon_git
2023-06-12
OsProcessCheckUtil.java
mjon_git
2023-06-12
PdfUtil.java
mjon_git
2023-06-12
RedirectUrlMaker.java
mjon_git
2023-06-12
StringUtil.java
mjon_git
2023-06-12
StringUtil2.java
mjon_git
2023-06-12
TokenUtil.java
mjon_git
2023-06-12
WebUtil.java
mjon_git
2023-06-12
XssFilterUtil.java
mjon_git
2023-06-12
hylee 2023-06-12 82380a5 mjon_git UNIX
Raw Open in browser Change history
package itn.com.cmm.util; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import javax.servlet.http.HttpServletResponse; /** * * @author : 이호영 * @fileName : PdfUtil.java * @date : 2023.03.16 * @description : PDF를 다루는 Utils * =========================================================== * DATE AUTHOR NOTE * ----------------------------------------------------------- * * 2023.04.06 이호영 최초 생성 * * * */ public final class PdfUtil { /** * 휴대폰번호 대시('-') 추가 * 대시 유무 상관없음 * 유효성 맞지 않을시 변환안됨. * @param response */ public static void showPdf(HttpServletResponse response, String pdfFileName) { FileInputStream fis = null; BufferedOutputStream bos = null; try { File pdfFile = new File(pdfFileName); // 클라이언트 브라우져에서 바로 보는 방법(헤더 변경) response.setContentType("application/pdf"); // ★ 이 구문이 있으면 [다운로드], 이 구문이 없다면 바로 target 지정된 곳에 view 해줍니다. // response.addHeader("Content-Disposition", "attachment; filename=" + pdfFile.getName() + ".pdf"); // 파일 읽고 쓰는 건 일반적인 Write방식이랑 동일합니다. 다만 reponse 출력 스트림 객체에 write. fis = new FileInputStream(pdfFile); int size = fis.available(); // 지정 파일에서 읽을 수 있는 바이트 수를 반환 byte[] buf = new byte[size]; // 버퍼설정 int readCount = fis.read(buf); response.flushBuffer(); bos = new BufferedOutputStream(response.getOutputStream()); bos.write(buf, 0, readCount); bos.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (fis != null) fis.close(); // close는 꼭! 반드시! if (bos != null) bos.close(); } catch (IOException e) { e.printStackTrace(); } } } }

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up