ช่วยด้วยครับ PHP PDF/FPDF - MySQL Export to PDF ภาษาไทย มันเป็นภาษาต่างดาวครับ

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ช่วยด้วยครับ PHP PDF/FPDF - MySQL Export to PDF ภาษาไทย มันเป็นภาษาต่างดาวครับ

ช่วยด้วยครับ PHP PDF/FPDF - MySQL Export to PDF ภาษาไทย มันเป็นภาษาต่างดาวครับ

ช่วยด้วยครับ PHP PDF/FPDF - MySQL Export to PDF ภาษาไทย มันเป็นภาษาต่างดาวครับ<?php 

require 'fpdf.php';
define('PDF_FONTPATH','font/');
$db= new PDO('mysql:host=localhost;dbname=waterwork','root','bestterry38');
 
 
class PDF extends FPDF{
    function header(){
        
        $this->Setfont('Arial','B',14);
        $this->Cell(276,10,'TEST PaGE Margin',0,0,'C');
        $this->Ln();
        $this->Setfont('Arial','',12);
        $this->Cell(276,10,'sterrt Employee',0,0,'C');
        $this->Ln();
    }  
    function footer(){
        $this->SetY(-15);
        $this->Setfont('Arial','',8);
        $this->Cell(0,10,'Page'.$this->PageNo().'/{nb}',0,0,'C');
    }
    function headertable(){
       
        $this->Cell(40,10,iconv('UTF-8','TIS-620','รหัส'),1,0,'C');
        $this->Cell(40,10,iconv('UTF-8','TIS-620','ชื่อ'),1,0,'C');
        $this->Cell(40,10,iconv('UTF-8','TIS-620','นามสกุล'),1,0,'C');
        $this->Cell(40,10,iconv('UTF-8','TIS-620','บ้านเลขที่'),1,0,'C');
        $this->Cell(40,10,iconv('UTF-8','TIS-620','หมู่ที่'),1,0,'C');
        $this->Cell(40,10,'UserId',1,0,'C');
        $this->Ln();
    }
    function viewTable($db){
        
        $this->Addfont('angsa','','angsa.php');
        $this->SetFont('angsa','','16');
        
        $stmt = $db->query('SELECT * FROM address INNER JOIN datauser ON address.userid=datauser.userid ORDER BY villageno DESC');
        mysql_query("SET NAMES 'tis620' ");
        while($data = $stmt->fetch(PDO::FETCH_OBJ)){
            $this->Cell(40,7,$data->villageid,1,0,'C');
            $this->Cell(40,7,$data->name,1,0,'C');
            $this->Cell(40,7,$data->lastname,1,0,'L');
            $this->Cell(40,7,$data->address,1,0,'L');
            $this->Cell(40,7,$data->villageno,1,0,'L');
            $this->Cell(40,7,$data->userid,1,0,'L');
            $this->Ln();
        }
    }
}
 
 
$pdf = new PDF();
$pdf->AddFont('angsana','','angsa.php');
$pdf->AddFont('angsana','B','angsab.php');
$pdf->AddFont('angsana','I','angsai.php');
$pdf->AddFont('angsana','BI','angsaz.php');
$pdf->SetFont('angsana','',16);
$pdf->AddPage('L','A4',0);
$pdf->headertable();
$pdf->viewTable($db);
$pdf->Output();
?>
 


Bestterry 183.88.19.xxx 07-09-2017 23:51:48

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
  ลองเปลี่ยนมาใช้ tcpdf หรือ phpexcel ดู

แนวทางจัดรูปแบบ header และ footer ของ pdf ไฟล์ที่สร้างด้วย tcpdf 
https://www.ninenik.com/content.php?arti_id=803 via @ninenik

ใช้งาน PHPExcel ร่วมกับ mPDF ออกรายงานเป็น pdf รองรับภาษาไทย 


ninenik 183.88.64.xxx 08-09-2017






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ