|
 |
|
ใครพอทราบวิธีการขึ้นหน้าใหม่ของ fpdf บ้างครับ รบกวนด้วยครับ |
|
 |
|
|
 |
 |
|
คือผมสร้างตารางขึ้นมาแล้วพอป้อนข้อมูลลงไปอีก มันเกินออกมาจากตารางอ่ะครับ

ผมเลยอยากจะให้มันขึ้นเป็นหน้าใหม่ครับ ใครพอมีวิธีช่วยผมทีครับ
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

|
|
 |
 |
 |
 |
Date :
2014-09-08 16:13:36 |
By :
chaolea |
View :
1939 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใครพอมีวิธีช่วยผมด้วยครับ
|
 |
 |
 |
 |
Date :
2014-09-08 17:05:51 |
By :
chaolea |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือผมอยากได้ตารางให้อยู่อีกหน้านึงโดยข้อความไม่เกินออกจากตารางต้องทำไงครับ
|
 |
 |
 |
 |
Date :
2014-09-09 11:50:55 |
By :
chaolea |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเอาไปวางแล้วรันดู ว่าใช่ป่าว ผมเทสแล้วมันทำได้
พอเอาไปทำเป็นของตัวเอง ต้องลองปรับดูนะ 

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 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|