pdf를 생성하는 php프로그램.
아래는 예제 소스
require_once($_SERVER['DOCUMENT_ROOT'].'/tcpdf/tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('odal');
$pdf->SetTitle('TCPDF Rentcar_Voucher');
$pdf->SetSubject('rentcar_voucher');
$pdf->SetKeywords('rentcar, PDF, reservation, voucher');
// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//$pdf->setFooterData(array(0,64,0), array(0,64,128));
// set header and footer fonts
//$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
//$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
//$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetMargins(PDF_MARGIN_LEFT, 15, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists($_SERVER['DOCUMENT_ROOT'].'/tcpdf/examples/lang/kor.php')) {
require_once($_SERVER['DOCUMENT_ROOT'].'/tcpdf/examples/lang/kor.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
//$pdf->SetFont('helvetica', '', 14, '', true);
$pdf->SetFont('cid0kr', '', 10);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
//$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
// Set some content to print
//<img src="/image/old_odal/pdf_title.jpg" >
//Image ($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array())
$pdf->Image('/image/old_odal/pdf_title.jpg', '', '', '', '', 'JPEG', '', 'T', true, 300, 'C', false, false, 0, "CM", false, 1);
$pdf->Ln(30);
$html = <<<EOF
※ 현지에서 실제 운전자와 다시 계약하니 예약자 이름과 운전자 이름이 달라도 괜찮습니다.<br>
※ 예약확인서를 렌터카 접수 카운터에 운전자의 <span style="color:rgb(219,37,44);">"국제운전면허증 원본, 국제운전면허증 사본</span>(유효기간이 적혀있는 앞표지, 사진나온면 2곳을 복사)" 과 함께 제출해주세요.<br>
※ 국제운전면허증 원본을 가져오지 않으시면 렌트 자체가 안되오니 주의 해주세요!!<br>
※ 결제는 현지에서 신용카드(Visa, Master, Amex) 또는 엔화현금으로 지불 해주세요.<br>
※ 휴대폰을 로밍해 가시면 만약의 사태시 빠르게 대처하실수 있도록 도와 드립니다.<br>
※ 여행중 긴급연락처 ☎
EOF;
$pdf->Output('voucher.pdf', 'I');
'웹프로그래밍 > 라이브러리' 카테고리의 다른 글
다음 API 사용샘플 (0) | 2016.06.24 |
---|---|
구글맵 api 3.0 마커들 센터잡기 (0) | 2014.10.07 |
스키터 슬라이더 (0) | 2014.06.13 |
제이쿼리(jQuery) 와 프로토타입(prototype) 충돌 문제 (0) | 2013.07.11 |
prototype.js 프로토타입 메뉴얼 (0) | 2013.05.24 |