コード例 #1
0
ファイル: order_pdf.php プロジェクト: wanchalerm15/Project_2
$result_member = mysql_query("select * from member where member_id=" . MEMBER_ID);
$member = mysql_fetch_array($result_member);
$result_order = mysql_query("select * from order_music where order_id=" . ORDER_ID);
$order = mysql_fetch_array($result_order);
$orderID = $order['order_id'];
$orderDate = $order['order_date'];
require '../../web_server_script/php_function.php';
$order_pays = checkPayment($order['order_pays']);
$orderStatus = order_status($order['order_status']);
$order_cost = $order['order_cost'];
$memberName = $member['member_name'];
$memberAddress = $member['member_address'];
$memberTel = $member['member_tel'];
$memberIdentification = $member['member_identification'];
require '../ThaiPDF.class.php';
$PDF = new ThaiPDF();
$PDF->AddThaiFont();
$PDF->AddFont('angsana', ' ', 'angsa.php');
$PDF->AddFont('angsana', 'B', 'angsab.php');
$PDF->AddFont('angsana', 'I', 'angsai.php');
$PDF->AddFont('angsana', 'BI', 'angsaz.php');
$PDF->AddPage();
$PDF->SetFont("angsana", "I", 15);
$PDF->Image("../../images/pdf-logo.gif", 10, 10, 65, 15);
$PDF->SetXY(100, 20);
$PDF->SetDrawColor(220, 220, 220);
$PDF->MultiCell(100, 6, iconv("utf-8", "cp874", "Order-Number:" . ORDER_ID . "/" . $orderDate), 0, "R");
$PDF->Line(10, 28, 200, 28);
$PDF->SetFont("angsana", "B", 17);
$PDF->Write(17, iconv("utf-8", "cp874", "{$WEB_THAI_NAME} ( {$WEB_ENG_NAME} )"));
$PDF->SetXY(10, 30);
コード例 #2
0
 function OpenTag($tag, $attr)
 {
     //Opening tag
     switch ($tag) {
         case 'SUP':
             if (!empty($attr['SUP'])) {
                 //Set current font to 6pt
                 $this->SetFont('', '', 6);
                 //Start 125cm plus width of cell to the right of left margin
                 //Superscript "1"
                 $this->Cell(2, 2, $attr['SUP'], 0, 0, 'L');
             }
             break;
         case 'TABLE':
             // TABLE-BEGIN
             if (!empty($attr['BORDER'])) {
                 $this->tableborder = $attr['BORDER'];
             } else {
                 $this->tableborder = 0;
             }
             break;
         case 'TR':
             //TR-BEGIN
             break;
         case 'TD':
             // TD-BEGIN
             if (!empty($attr['WIDTH'])) {
                 $this->tdwidth = $attr['WIDTH'] / 4;
             } else {
                 $this->tdwidth = 50;
                 // Set to your own width if you need bigger fixed cells (old value  is 40)
             }
             if (!empty($attr['HEIGHT'])) {
                 $this->tdheight = $attr['HEIGHT'] / 6;
             } else {
                 $this->tdheight = 8;
                 // Set to your own height if you need bigger fixed cells (old value is 6)
             }
             if (!empty($attr['ALIGN'])) {
                 $align = strtoupper($attr['ALIGN']);
                 // <-- á¡éä¢ Bug
                 if ($align == 'LEFT') {
                     $this->tdalign = 'L';
                 }
                 if ($align == 'CENTER') {
                     $this->tdalign = 'C';
                 }
                 if ($align == 'RIGHT') {
                     $this->tdalign = 'R';
                 }
             } else {
                 $this->tdalign = 'L';
                 // Set to your own
             }
             if (!empty($attr['BGCOLOR'])) {
                 $coul = ThaiPDF::hex2dec($attr['BGCOLOR']);
                 $this->SetFillColor($coul['R'], $coul['G'], $coul['B']);
                 $this->tdbgcolor = true;
             }
             $this->tdbegin = true;
             break;
         case 'HR':
             if (!empty($attr['WIDTH'])) {
                 $Width = $attr['WIDTH'];
             } else {
                 $Width = $this->w - $this->lMargin - $this->rMargin;
             }
             $x = $this->GetX();
             $y = $this->GetY();
             $this->SetLineWidth(0.2);
             $this->Line($x, $y, $x + $Width, $y);
             $this->SetLineWidth(0.2);
             $this->Ln(1);
             break;
         case 'STRONG':
             $this->SetStyle('B', true);
             break;
         case 'EM':
             $this->SetStyle('I', true);
             break;
         case 'B':
         case 'I':
         case 'U':
             $this->SetStyle($tag, true);
             break;
         case 'A':
             $this->HREF = $attr['HREF'];
             break;
         case 'IMG':
             if (isset($attr['SRC'])) {
                 // <-- á¡éä¢ Bug
                 //if((isset($attr['WIDTH']) || isset($attr['HEIGHT']))) {
                 if (!isset($attr['WIDTH'])) {
                     $attr['WIDTH'] = 0;
                 }
                 if (!isset($attr['HEIGHT'])) {
                     $attr['HEIGHT'] = 0;
                 }
                 //}
                 $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), ThaiPDF::px2mm($attr['WIDTH']), ThaiPDF::px2mm($attr['HEIGHT']));
             }
             break;
         case 'BLOCKQUOTE':
         case 'BR':
             $this->Ln(5);
             break;
         case 'P':
             $this->Ln(10);
             break;
         case 'FONT':
             if (isset($attr['COLOR']) && $attr['COLOR'] != '') {
                 $coul = ThaiPDF::hex2dec($attr['COLOR']);
                 $this->SetTextColor($coul['R'], $coul['G'], $coul['B']);
                 $this->issetcolor = true;
             }
             if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist)) {
                 $this->SetFont(strtolower($attr['FACE']));
                 $this->issetfont = true;
             }
             if (isset($attr['FACE']) && in_array(strtolower($attr['FACE']), $this->fontlist) && isset($attr['SIZE']) && $attr['SIZE'] != '') {
                 $this->SetFont(strtolower($attr['FACE']), '', $attr['SIZE']);
                 $this->issetfont = true;
             }
             break;
     }
 }