HTML 을 PDF로 출력하기 위해 테스트하고 간략하게 적어둔다.
###### TCPDF 설치 ############
# 1. 웹 브라우저에서 https://sourceforge.net/projects/tcpdf/files/ 에 접속하여 TCPDF를 다운받는다.
# 현재 기준 tcpdf_6_3_2.zip 가 가장 최신이다.
# 다운로드 받은 파일을 리눅스 /usr/share/php 경로에 업로드 한다.
# 다른 경로에 설치해도 되는데 나눔폰트 설치 경로를 변경하기 싫어서 이곳 저곳 설치해보고 그냥 이 폴더로 정했다.
cd /usr/share/php
unzip tcpdf_6_3_2.zip
# 나눔폰트 설치 방법
cd /usr/share/fonts/
wget http://cdn.naver.com/naver/NanumFont/fontfiles/NanumFont_TTF_ALL.zip
unzip NanumFont_TTF_ALL.zip -d NanumFont
cd /usr/share/php/tcpdf/tools/
ls /usr/share/fonts/NanumFont/*
ls /usr/share/fonts/NanumFont/* | xargs -I TTF php tcpdf_addfont.php -i TTF
ll /usr/share/php/tcpdf/fonts/ | grep nanum
# 예제파일을 참조하여 실행할 php 디렉토리에서 내용을 구현한다.
먼저 화면상으로 원하는 형태로 출력이 되는지 확인하고 최종적으로 PDF 파일로 생성되도록 하면 된다.
tcpdf_include.php 파일에서 경로를 수정해준다.
$tcpdf_include_dirs = array(
realpath('/usr/share/php/tcpdf/tcpdf.php'),
'/usr/share/php/tcpdf/tcpdf.php'
);
<?php |
참조 사이트
https://wickedmagic.tistory.com/571
https://zetawiki.com/wiki/TCPDF_%ED%95%9C%EA%B8%80_%ED%8F%B0%ED%8A%B8_%EC%82%AC%EC%9A%A9
'안드로이드 > Android QRCode' 카테고리의 다른 글
Android QRCode 샘플 (0) | 2020.08.25 |
---|---|
PHP QR code 생성하는 방법 (0) | 2020.03.04 |
QRCode 개요 (0) | 2020.03.03 |