일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 아우디 A6 40TDI
- iphone6SPlus
- 비츠 솔로3
- 영어 감사표현
- 구찌 클러치백
- 아이폰6S플러스
- 45TFSI
- 네셔널지오그래픽 백팩
- 아이폰6s
- 코오롱 헤스티아
- 아이패드
- 아이패드용 키보드
- GA-2100
- AUDI A5 SPORTBACK
- 아이폰12 미니
- mysql
- 아우디 A5 스포트 백
- 맥미니 M1
- M1칩
- 아우디A5
- iPhone 12 mini
- 경량패딩
- 애플
- U플러스샵
- 맥미니 2020
- 루틴 다이어리
- 남자 클러치백
- 지얄오크
- MSI #MSI Prestige #MSI 프레스티지 #MSI 노트북 #노트북
- 스타벅스 다이어리
- Today
- Total
누눕's blog
html2canvas 와 jsPDF로 pdf 저장기능 만들기 본문
https://itinerant.tistory.com/51
[JavaScript] html2canvas 사용 방법
[JavaScript] html2canvas html2canvas : 웹(html)에서 화면을 캡쳐하는 기능. 실질적으로는 선택한 요소를 Canvas에 그린다. 하위 자식들까지 모두 canvas에 그린다. 예1) Body 안의 모든 요소를 Canvas에 그릴..
itinerant.tistory.com
CDN : <script src="html2canvas.hertzen.com/dist/html2canvas.js"></script>
기본 함수 :
html2canvas(document.getElementById("content")).then(function(canvas) {
함수 내용
});
옵션 추가할 때 : {}안에다 옵션 설정
html2canvas(document.getElementById("content"), {
allowTaint: true,
useCORS: true,
logging: false,
height: window.outerHeight + window.innerHeight,
windowHeight: window.outerHeight + window.innerHeight
}).then(function(canvas) {
함수 내용
});
옵션 참조 :
html2canvas.hertzen.com/configuration/
Options - html2canvas
Options Explore the different configuration options available for html2canvas
html2canvas.hertzen.com
이미지가 잘리지 않게 나오게 하고 싶을 때 :
HTML2Canvas does not render full div, only what is visible on screen?
I'm trying to use HTML2Canvas to render the contents of a div. Here is the code: var htmlSource = $('#potenzial-page')[0]; $('#btn').on("click", function() { html2canvas(htmlSource).
stackoverflow.com
예제 코드 (캡처가 잘리지 않게 pdf 저장) :
참조 :
https://devheedoo.github.io/posts/save-html-to-pdf/
Save HTML to PDF - Heedo's Dev Blog
프로젝트에서 HTML 화면을 PDF로 출력해야하는 경우가 생겼다. iText 라이브러리의 경우 html을 pdf로 변환해주지만 CSS 적용에 한계가 있었다. 그래서 두 가지 라이브러리를 이용해 현재 화면을 이미�
devheedoo.github.io
https://devlink.tistory.com/242
자바스크립트에서 pdf 출력하기 (html2canvas + jspdf)
https://rawgit.com/MrRio/jsPDF/master/docs/jsPDF.html jsPDF - Documentation The identity matrix (equivalent to new Matrix(1, 0, 0, 1, 0, 0)). Starts a new pdf form object, which means that all conse..
devlink.tistory.com
'IT 기록 > javaScript' 카테고리의 다른 글
자바스크립트 Object.keys() 함수 (0) | 2020.07.03 |
---|---|
자바스크립트 pdf로 저장 (0) | 2020.05.20 |
자바스크립트 날짜 (0) | 2020.05.19 |
자바스크립트(javaScript) 삽입 위치 (0) | 2020.03.30 |