 |
|
น่าจะเอาโค้ดมาวางไว้หน่ะครับ
ประมาณนี้หรือเปล่า
Code (PHP)
<?php require_once('Report_pdf/fpdf.php');?>
<?php
class PDF extends FPDF {
function SetThaiFont() {
$this->AddFont('AngsanaNew','','angsa.php');
}
function conv($string) {
return iconv('UTF-8', 'TIS-620', $string);
}
}
?>
<?php
$pdf = new PDF( 'L' , 'mm' , 'A4'); // กำหนดขนาดกระดาษเริ่มต้นที่ A4 และมีแนวนอน
$pdf->SetThaiFont();
$pdf->SetMargins(10,10,10); // กันขอบเอกสารที่ 10
for($i=0;$i<3;$i++){
$pdf->AddPage(); // ทำการเพิ่มหน้าใหม่ให้ PDF
$pdf->SetFont('AngsanaNew', '', 12); //กำหนด อักษร
$pdf->Cell( 40 , 8 , $pdf->conv("นายทดสอบ"), '0','0','L');
$pdf->Cell( 30 , 8 , $pdf->conv("กทม 1122") , '0','0','L');
$pdf->Ln(); // ขึ้นบรรทัดใหม่
$pdf->Cell( 40 , 8 , $pdf->conv(" การทำงานขั้นแรก"), '0','0','L');
$pdf->Ln(); // ขึ้นบรรทัดใหม่
}
//$pdf->Output(); // ออกเป็นรายงาน
$pdf->Output( 'test.pdf' , 'D' );
?>
|
 |
 |
 |
 |
Date :
2011-04-28 11:11:33 |
By :
ไวยวิทย์ |
|
 |
 |
 |
 |
|
|
 |