Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ใครพอทราบวิธีการขึ้นหน้าใหม่ของ fpdf บ้างครับ รบกวนด้วยครับ



 

ใครพอทราบวิธีการขึ้นหน้าใหม่ของ fpdf บ้างครับ รบกวนด้วยครับ

 



Topic : 111157



โพสกระทู้ ( 48 )
บทความ ( 0 )



สถานะออฟไลน์




คือผมสร้างตารางขึ้นมาแล้วพอป้อนข้อมูลลงไปอีก มันเกินออกมาจากตารางอ่ะครับ

กกก

ผมเลยอยากจะให้มันขึ้นเป็นหน้าใหม่ครับ ใครพอมีวิธีช่วยผมทีครับ

Code (PHP)
<?
	include_once"connect.php";
	
	$id=$_POST['id'];
	$explode=explode(":",$id[0]);
	$ex_id=$explode[0];
	$ex_cus=$explode[1];
	
	$customer=$_POST['customer'];
	$sql_number=mysql_query("SELECT * FROM customer_info where cust_name like '".$ex_cus."' ");
	$rs_number=mysql_fetch_array($sql_number);
	 
?>
<?PHP

    define('FPDF_FONTPATH','font/');
    require('fpdf.php');
    include "connect.php";
    

    class PDF extends FPDF
    {
        function LoadData($file)
        {
            $lines = file($file);
            $data = array();
            foreach($lines as $line)
                $data[]=explode(';',chop($line));
                return $data;
        }

        function Header() 
     { 
	 $this->AddFont('angsana','','angsa.php'); 
         $this->SetFont( 'angsana', '', 14 ); 
         $this->Image('images/logo.jpg',10,10,0,15,'jpg',''); 
 
  		 
   		 $this->Cell(50,5,'',0,0,'C',0);//จัดอยู่กึ่งกลาง
		 $this->SetFillColor(205,201,201);
   		 $this->Cell(75 ,10, iconv( 'UTF-8','cp874' ,'ใบส่งสินค้าซ่อม / Repair Note'),1,1,'C',true);
   		
	     $this->ln( 5 ); 
		 
     } 
     function Footer() 
     { 
         //move pionter at the bottom of the page 
         $this->SetY( -70 ); 

         //set font to Arial, Bold, size 10 
        $this->AddFont('angsana','','angsa.php'); 
         $this->SetFont( 'angsana', '', 14 ); 
         $this->Ln();
         $this->Cell(20,5,'',0,0,'C',0);//จัดอยู่กึ่งกลาง
         $this->Cell(0 , 8, iconv( 'UTF-8','cp874' ,'ผู้ส่งสินค้า / Delivered By                                                                                      ผู้รับสินค้า(ลงชื่อตัวบรรจง)'),0,1,'L' );
         $this->Ln();
         $this->Cell(20,5,'',0,0,'C',0);//จัดอยู่กึ่งกลา
         $this->Cell(0 , 1, iconv( 'UTF-8','cp874' ,'                                                                                                                                          Received by'),0,1,'L' );
         $this->Ln(); 
         $this->Cell(15,5,'',0,0,'C',0);//จัดอยู่กึ่งกลาง                                 
         $this->Cell(0,8,'....................................................                                                                            ........................................................',0,1,'L',0);
         $this->Cell(14,5,'',0,0,'C',0);//จัดอยู่กึ่งกลาง                 
         $this->Cell(0,8,'(....................................................)                                                                          (........................................................)',0,1,'L',0);
         $this->Cell(14,5,'',0,0,'C',0);//จัดอยู่กึ่งกลาง 
         $this->Cell(0,8,'      .........../............./..............                                                                                            ........../............./............',0,1,'L',0);
		  
 }
 }

    $pdf = new PDF();
    $pdf->AddPage();
   $pdf->AddFont('angsana','','angsa.php'); 

     $pdf->Cell(35 , 8, iconv( 'UTF-8','cp874' ,'บริษัท / Company'),0,0,'U' );
     $pdf->Cell(106 , 8, iconv( 'UTF-8','cp874',$rs_number['cust_name']),0,0,'U' );  
	 $pdf->Cell(15 , 8, iconv( 'UTF-8','cp874' ,'NO'),0,0,'U' );
	 $pdf->Cell(34 , 8, iconv( 'UTF-8','cp874' ,$rs_number['cust_id']),0,1,'U' );
     $pdf->Cell(35 , 8, iconv( 'UTF-8','cp874' ,'ที่อยู่ / Address'),0,0,'L' ); 
     $pdf->Cell(155 , 8, iconv( 'UTF-8','cp874' ,$rs_number['cust_add']),0,1,'L' );  
     $pdf->Cell(35 , 8, iconv( 'UTF-8','cp874' ,'โทร. / Tel.'),0,0,'L' );  
     $pdf->Cell(106 , 8, iconv( 'UTF-8','cp874' ,$rs_number['cust_phone']),0,0,'L' );
     $pdf->Cell(15 , 8, iconv( 'UTF-8','cp874' ,'Date:'),0,0,'L' );
     $pdf->Cell(34 , 8, iconv( 'UTF-8','cp874' ,date("d/m/Y")),0,1,'L' );  
     $pdf->Cell(35 , 8, iconv( 'UTF-8','cp874' ,'ผู้สั่งซ่อม'),0,0,'L' );
     $pdf->Cell(15 , 8, iconv( 'UTF-8','cp874' ,$rs_number['name']),0,0,'L' );     
     $pdf->Cell(10 , 8, iconv( 'UTF-8','cp874' ,'โทร.'),0,0,'L' ); 
     $pdf->Cell(34 , 8, iconv( 'UTF-8','cp874' ,$rs_number['cust_phone2']),0,0,'L' ); 
     $pdf->Cell(15 , 8, iconv( 'UTF-8','cp874' ,'Email:'),0,0,'L' ); 
     $pdf->Cell(34 , 8, iconv( 'UTF-8','cp874' ,$rs_number['cust_mail']),0,1,'L' );   
	  $pdf->Cell(50,5,'',0,1,'C',0);//เว้นบรรทัด

	      $sql=mysql_query("SELECT  * from exstock where id='".$ex_id."'");
	      $num=mysql_num_rows($sql);
		  
     $pdf->SetFillColor(205,201,201);
     $pdf->Cell(15,7,iconv( 'UTF-8','cp874' ,'รายการ'),'LTR',0,'C',true);
     $pdf->Cell(30,7,iconv( 'UTF-8','cp874' ,'รหัสสินค้า'),'LTR',0,'C',true);
     $pdf->Cell(90,7,iconv( 'UTF-8','cp874' ,'รายละเอียดสินค้า'),'LTR',0,'C',true);
     $pdf->Cell(15,7,iconv( 'UTF-8','cp874' ,'จำนวน'),'LTR',0,'C',true);
     $pdf->Cell(40,7,iconv( 'UTF-8','cp874' ,'หมายเลขเครื่อง'),'LTR',1,'C',true);
	 $pdf->Cell(15,7,iconv( 'UTF-8','cp874' ,'Item'),'LBR',0,'C',true);
     $pdf->Cell(30,7,iconv( 'UTF-8','cp874' ,'Part No.'),'LBR',0,'C',true);
     $pdf->Cell(90,7,iconv( 'UTF-8','cp874' ,'Description'),'LBR',0,'C',true);
     $pdf->Cell(15,7,iconv( 'UTF-8','cp874' ,'Q"ty'),'LBR',0,'C',true);
     $pdf->Cell(40,7,iconv( 'UTF-8','cp874' ,'Serial No.'),'LBR',1,'C',true);
     


	for($i=0;$i<count($id);$i++){
		
   $ex_id=explode(":",$id[$i]);
   $select=mysql_query("SELECT * FROM exstock WHERE id='".$ex_id[0]."'") or die (mysql_error());
   $row=mysql_fetch_array($select);
		
   $pdf->Cell(15,7,++$n,'LR',0,'C');
   $pdf->Cell(30,7,$row['product_id'],'LR',0,'C');
   $pdf->Cell(90,7,$row['product_des'],'LR',0,'C');
   $pdf->Cell(15,7,$row['quantity'],'LR',0,'C');
   $pdf->Cell(40,7,$row['serial'],'LR',0,'C');
   $pdf->Ln();

}
    
    $height = 108;
    $term = 7;
    $line = $height - ($term * $i);

    $pdf->Cell(15,$line, '','LR');
    $pdf->Cell(30,$line, '','LR');
    $pdf->Cell(90,$line, '','LR');
    $pdf->Cell(15,$line, '','LR');
    $pdf->Cell(40,$line, '','LR');
    $pdf->Ln();

    

    $pdf->Cell(65,11,iconv( 'UTF-8','cp874' ,'หมายเหตุ / Note :                             อาการเสีย:-'),'LT',0,'L',0);
$pdf->Cell(125,11,iconv( 'UTF-8','cp874' ,$row['note']),'TR',1,'L',0);
$pdf->Cell(65,11,iconv( 'UTF-8','cp874' ,'                                                          project:'),'LB',0,'L',0);
$pdf->Cell(125,11,iconv( 'UTF-8','cp874' ,$row['project']),'BR',1,'L',0);

    $pdf->Output("test.pdf", 'I');

?>





Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-09-08 16:13:36 By : chaolea View : 1829 Reply : 3
 

 

No. 1



โพสกระทู้ ( 48 )
บทความ ( 0 )



สถานะออฟไลน์


ใครพอมีวิธีช่วยผมด้วยครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-09-08 17:05:51 By : chaolea
 


 

No. 2



โพสกระทู้ ( 48 )
บทความ ( 0 )



สถานะออฟไลน์


คือผมอยากได้ตารางให้อยู่อีกหน้านึงโดยข้อความไม่เกินออกจากตารางต้องทำไงครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-09-09 11:50:55 By : chaolea
 

 

No. 3



โพสกระทู้ ( 361 )
บทความ ( 1 )



สถานะออฟไลน์


ลองเอาไปวางแล้วรันดู ว่าใช่ป่าว ผมเทสแล้วมันทำได้

พอเอาไปทำเป็นของตัวเอง ต้องลองปรับดูนะ

ภถ

Code (PHP)
<?PHP

    define('FPDF_FONTPATH','font/');
    require('fpdf.php');
    include "../config/connect.php";

    class PDF extends FPDF
    {
        function LoadData($file)
        {
            $lines = file($file);
            $data = array();
            foreach($lines as $line)
                $data[]=explode(';',chop($line));
                return $data;
        }

        function Header()
        {
            $this->AddFont('THSarabun','B','THSarabunb.php');
            $this->SetFont('THSarabun','B',18);

            $this->Cell(190,7,iconv('UTF-8', 'TIS-620', "รายชื่อนักศึกษาฝึกประสบการณ์วิชาชีพ"),0,0,'C');
            $this->Ln(10);
            
            // หัวตาราง
            $this->SetFillColor(205,201,201);
            $this->Cell(20,7, iconv('UTF-8', 'TIS-620', "#"),1,0,'C',true);
            $this->Cell(80,7, iconv('UTF-8', 'TIS-620', "ชื่อ-นามสกุล"),1,0,'C',true);
            $this->Cell(90,7, iconv('UTF-8', 'TIS-620', "โทรศัพท์"),1,0,'C',true);
            $this->Ln();
        }

        function Footer()
        {
            $this->AddFont('THSarabun','','THSarabun.php');
            $this->SetFont('THSarabun','',14);
            $this->SetY(-60); // กำหนด footer จากล่าง ขึ้นมา
            $this->Cell(190,7, iconv('UTF-8', 'TIS-620', 'หมายเหตุ'),'1',0,'L');
	}
    }

    $pdf = new PDF();
    $pdf->AddPage();
    $pdf->AddFont('THSarabun','','THSarabun.php');
    $pdf->SetFont('THSarabun','',16);
    $pdf->SetAutoPageBreak(true, 55); // กำหนดว่าให้หน้านึงมันไปสุดตรงไหน ใส่เลขเยอะยิ่งเว้นด้านล่างเยอะ

    for ($i=0;$i<80;$i++){ // ปรับจำนวนข้อมูลดู

        $pdf->Cell(20,7, iconv('UTF-8', 'TIS-620',++$n),'LR',0,'C');
        $pdf->Cell(80,7, iconv('UTF-8', 'TIS-620','TEST TEST'),'LR',0,'L');
        $pdf->Cell(90,7, iconv('UTF-8', 'TIS-620','XXX-XXXXXXX'),'LR',0,'L');
        $pdf->Ln();
    }

    $height = 210; // ความสูงตาราง : หน้า (กำหนดให้ไปชนกับ footer)
    $term   = 7; // ความสูงบรรทัด
    $data   = $i % 30; // เศษ = ข้อมูลที่มีทั้งหมด % ข้อมูลมีได้มากที่สุดในแต่ละหน้า (ตย. 1 = 5 % 2)
    $line   = $height - ($term * $data);
 
    $pdf->Cell(20,$line,'','LR');
    $pdf->Cell(80,$line,'','LR');
    $pdf->Cell(90,$line,'','LR');
    $pdf->Ln();

    $pdf->Output("".date('Ymd_His').".pdf", 'I');
?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-09-10 11:15:29 By : sabaitip
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ใครพอทราบวิธีการขึ้นหน้าใหม่ของ fpdf บ้างครับ รบกวนด้วยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่