|
|
บาร์โค้ดกับตัวเลขออกมาดีนะค่ะ แตต่ต้องการจะพิมพ์ชื่อหนังสือออกมาด้วย แต่ชื่อหนังสือภาษาไทยดันไม่ยอมออกมาเลย แต่ชื่อภาษาอังกฤษดันออกมา ทำCode (PHP)
<?php
require("fpdf.php");
//ทำการสืบทอดคลาส FPDF ให้เป็นคลาสใหม่
class PDF extends FPDF
{
//Override คำสั่ง (เมธอด) Header
function Header() {
//นับจากขอบกระดาษด้านล่างขึ้นมา 5 มม.
$this->SetY( 5 );
//กำหนดใช้ตัวอักษร AngsanaNew ตัวเอียง ขนาด 12
$this->SetFont('AngsanaNew','',12);
}
}
$pdf = new PDF('L' , 'mm' , 'A4');
$pdf->AddFont('AngsanaNew','','angsa.php');
$pdf->AddFont('AngsanaNew','B','angsab.php');
$pdf->AddFont('AngsanaNew','I','angsai.php');
$pdf->AddFont('AngsanaNew','IB','angsaz.php');
$pdf->AddFont('Barcode','B','barcode.php');
$pdf->AddFont('Barcode2','','barcode2D.php');
$pdf->AddFont("canNongAor","","nongaor.php");
$pdf->AddFont('CordiaNew','','cordia.php');
$pdf->AddFont('CordiaNew','B','cordiab.php');
$pdf->AddFont('CordiaNew','I','cordiai.php');
$pdf->AddFont('CordiaNew','IB','cordiaz.php');
$pdf->AddFont('Tahoma','','tahoma.php');
$pdf->AddFont('Tahoma','B','tahomab.php');
$pdf->AddFont('BrowalliaNew','','browa.php');
$pdf->AddFont('BrowalliaNew','B','browab.php');
$pdf->AddFont('BrowalliaNew','I','browai.php');
$pdf->AddFont('BrowalliaNew','IB','browaz.php');
$pdf->AddFont('KoHmu','','kohmu.php');
$pdf->AddFont('KoHmu2','','kohmu2.php');
$pdf->AddFont('KoHmu3','','kohmu3.php');
$pdf->AddFont('MicrosoftSansSerif','','micross.php');
$pdf->AddFont('PLE_Cara','','plecara.php');
$pdf->AddFont('PLE_Care','','plecare.php');
$pdf->AddFont('PLE_Care','B','plecareb.php');
$pdf->AddFont('PLE_Joy','','plejoy.php');
$pdf->AddFont('PLE_Tom','','pletom.php');
$pdf->AddFont('PLE_Tom','B','pletomb.php');
$pdf->AddFont('PLE_TomOutline','','pletomo.php');
$pdf->AddFont('PLE_TomWide','','pletomw.php');
$pdf->AddFont('DilleniaUPC','','dill.php');
$pdf->AddFont('DilleniaUPC','B','dillb.php');
$pdf->AddFont('DilleniaUPC','I','dilli.php');
$pdf->AddFont('DilleniaUPC','IB','dillz.php');
$pdf->AddFont('EucrosiaUPC','','eucro.php');
$pdf->AddFont('EucrosiaUPC','B','eucrob.php');
$pdf->AddFont('EucrosiaUPC','I','eucroi.php');
$pdf->AddFont('EucrosiaUPC','IB','eucroz.php');
$pdf->AddFont('FreesiaUPC','','free.php');
$pdf->AddFont('FreesiaUPC','B','freeb.php');
$pdf->AddFont('FreesiaUPC','I','freei.php');
$pdf->AddFont('FreesiaUPC','IB','freez.php');
$pdf->AddFont('IrisUPC','','iris.php');
$pdf->AddFont('IrisUPC','B','irisb.php');
$pdf->AddFont('IrisUPC','I','irisi.php');
$pdf->AddFont('IrisUPC','IB','irisz.php');
$pdf->AddFont('JasmineUPC','','jasm.php');
$pdf->AddFont('JasmineUPC','B','jasmb.php');
$pdf->AddFont('JasmineUPC','I','jasmi.php');
$pdf->AddFont('JasmineUPC','IB','jasmz.php');
$pdf->AddFont('KodchiangUPC','','kodc.php');
$pdf->AddFont('KodchiangUPC','B','kodc.php');
$pdf->AddFont('KodchiangUPC','I','kodci.php');
$pdf->AddFont('KodchiangUPC','IB','kodcz.php');
$pdf->AddFont('LilyUPC','','lily.php');
$pdf->AddFont('LilyUPC','B','lilyb.php');
$pdf->AddFont('LilyUPC','I','lilyi.php');
$pdf->AddFont('LilyUPC','IB','lilyz.php');
$pdf->SetMargins(25,10,18,5);
$pdf->AliasNbPages( 'tp' );
$pdf->SetThaiFont();
$pdf->AddPage();
$pdf->SetY(+10);
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
for($i=0;$i<count($_POST[ck]);$i++){
$sql_edit =$db->select_query("select * from tbl_book where no_id='".$_POST[ck][$i]."' ");
$data_edit = $db->fetch($sql_edit);
$pdf->SetFont('AngsanaNew','B',14);
$pdf->Cell(40,5,iconv('UTF-8', 'TIS-620',$data_edit [book_name]), 0, 1, 'C');
$pdf->Ln(1);
$pdf->SetFont('Barcode','B',16);
$pdf->Cell(40,5,iconv('UTF-8', 'TIS-620', '*'.$data_edit [no_id].'*'), 0, 1, 'C');
$pdf->Ln(1);
$pdf->SetFont('CordiaNew','B',14);
$pdf->Cell(40,5,iconv('UTF-8', 'TIS-620',$data_edit [no_id]), 0, 1, 'C');
$pdf->Ln(5);
}
$pdf->Output();
?>
เป็น pdf นะค่ะ วานผู้รู้ช่วยแนะนำหน่อยนะค่ะ
Tag : PHP
|
|
|
|
|
|
Date :
2011-09-04 01:32:59 |
By :
modzaa07 |
View :
1318 |
Reply :
2 |
|
|
|
|
|
|
|
|
|