Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_11-dev/data/class/SC_Fpdf.php

    r21024 r21358  
    3232define('PDF_TEMPLATE_REALDIR', TEMPLATE_ADMIN_REALDIR . 'pdf/'); 
    3333 
    34 class SC_Fpdf { 
     34class SC_Fpdf extends PDF_Japanese { 
    3535    function SC_Fpdf($download, $title, $tpl_pdf = 'nouhinsyo1.pdf') { 
     36        $this->FPDF(); 
    3637        // デフォルトの設定 
    3738        $this->tpl_pdf = PDF_TEMPLATE_REALDIR . $tpl_pdf;  // テンプレートファイル 
     
    5455        ); 
    5556 
    56         $this->pdf  = new PDF_Japanese(); 
     57        $this->lfAddGothicFont(); 
    5758 
    5859        // SJISフォント 
    59         $this->pdf->AddSJISFont(); 
    60         $this->pdf->SetFont('SJIS'); 
     60        $this->AddSJISFont(); 
     61        $this->SetFont('SJIS'); 
    6162 
    6263        //ページ総数取得 
    63         $this->pdf->AliasNbPages(); 
     64        $this->AliasNbPages(); 
    6465 
    6566        // マージン設定 
    66         $this->pdf->SetMargins(15, 20); 
     67        $this->SetMargins(15, 20); 
    6768 
    6869        // PDFを読み込んでページ数を取得 
    69         $pageno = $this->pdf->setSourceFile($this->tpl_pdf); 
     70        $pageno = $this->setSourceFile($this->tpl_pdf); 
    7071    } 
    7172 
     
    7475 
    7576        // ページ番号よりIDを取得 
    76         $tplidx = $this->pdf->ImportPage(1); 
     77        $tplidx = $this->ImportPage(1); 
    7778 
    7879        // ページを追加(新規) 
    79         $this->pdf->AddPage(); 
     80        $this->AddPage(); 
    8081 
    8182        //表示倍率(100%) 
    82         $this->pdf->SetDisplayMode($this->tpl_dispmode); 
     83        $this->SetDisplayMode($this->tpl_dispmode); 
    8384 
    8485        if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) { 
     
    8889 
    8990        // テンプレート内容の位置、幅を調整 ※useTemplateに引数を与えなければ100%表示がデフォルト 
    90         $this->pdf->useTemplate($tplidx); 
     91        $this->useTemplate($tplidx); 
    9192 
    9293        $this->setShopData(); 
     
    126127        //ロゴ画像 
    127128        $logo_file = PDF_TEMPLATE_REALDIR . 'logo.png'; 
    128         $this->pdf->Image($logo_file, 124, 46, 40); 
     129        $this->Image($logo_file, 124, 46, 40); 
    129130    } 
    130131 
     
    152153 
    153154        // お届け先情報 
    154         $this->pdf->SetFontSize(10); 
     155        $this->SetFont('SJIS', '', 10); 
    155156        $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 
    156157        $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 
    157158 
    158         $this->pdf->SetFont('', 'B', 15); 
    159         $this->pdf->Cell(0, 10, $this->lfConvSjis($this->tpl_title), 0, 2, 'C', 0, '');  //文書タイトル(納品書・請求書) 
    160         $this->pdf->Cell(0, 66, '', 0, 2, 'R', 0, ''); 
    161         $this->pdf->Cell(5, 0, '', 0, 0, 'R', 0, ''); 
    162         $this->pdf->Cell(67, 8, $this->lfConvSjis(number_format($this->arrDisp['payment_total'])." 円"), 0, 2, 'R', 0, ''); 
    163         $this->pdf->Cell(0, 45, '', 0, 2, '', 0, ''); 
    164  
    165         $this->pdf->SetFontSize(8); 
     159        $this->SetFont('Gothic', 'B', 15); 
     160        $this->Cell(0, 10, $this->lfConvSjis($this->tpl_title), 0, 2, 'C', 0, '');  //文書タイトル(納品書・請求書) 
     161        $this->Cell(0, 66, '', 0, 2, 'R', 0, ''); 
     162        $this->Cell(5, 0, '', 0, 0, 'R', 0, ''); 
     163        $this->SetFont('SJIS', 'B', 15); 
     164        $this->Cell(67, 8, $this->lfConvSjis(number_format($this->arrDisp['payment_total'])." 円"), 0, 2, 'R', 0, ''); 
     165        $this->Cell(0, 45, '', 0, 2, '', 0, ''); 
     166 
     167        $this->SetFont('SJIS', '', 8); 
    166168 
    167169        $monetary_unit = $this->lfConvSjis("円"); 
     
    252254        } 
    253255 
    254         $this->pdf->FancyTable($this->label_cell, $arrOrder, $this->width_cell); 
     256        $this->FancyTable($this->label_cell, $arrOrder, $this->width_cell); 
    255257    } 
    256258 
    257259    function setEtcData() { 
    258         $this->pdf->Cell(0, 10, '', 0, 1, 'C', 0, ''); 
    259         $this->pdf->SetFontSize(9); 
    260         $this->pdf->MultiCell(0, 6, $this->lfConvSjis("< 備 考 >"), 'T', 2, 'L', 0, '');  //備考 
    261         $this->pdf->Ln(); 
    262         $this->pdf->SetFontSize(8); 
    263         $this->pdf->MultiCell(0, 4, $this->lfConvSjis($this->arrData['etc1']."\n".$this->arrData['etc2']."\n".$this->arrData['etc3']), '', 2, 'L', 0, '');  //備考 
     260        $this->Cell(0, 10, '', 0, 1, 'C', 0, ''); 
     261        $this->SetFont('Gothic', 'B', 9); 
     262        $this->MultiCell(0, 6, $this->lfConvSjis("< 備 考 >"), 'T', 2, 'L', 0, '');  //備考 
     263        $this->Ln(); 
     264        $this->SetFont('SJIS', '', 8); 
     265        $this->MultiCell(0, 4, $this->lfConvSjis($this->arrData['etc1']."\n".$this->arrData['etc2']."\n".$this->arrData['etc3']), '', 2, 'L', 0, '');  //備考 
    264266    } 
    265267 
     
    268270        ob_clean(); 
    269271        if ($this->pdf_download == 1) { 
    270             if ($this->pdf->PageNo() == 1) { 
     272            if ($this->PageNo() == 1) { 
    271273                $filename = "nouhinsyo-No".$this->arrData['order_id'].".pdf"; 
    272274            } else { 
    273275                $filename = "nouhinsyo.pdf"; 
    274276            } 
    275             $this->pdf->Output($this->lfConvSjis($filename), 'D'); 
     277            $this->Output($this->lfConvSjis($filename), 'D'); 
    276278        } else { 
    277             $this->pdf->Output(); 
     279            $this->Output(); 
    278280        } 
    279281 
    280282        // 入力してPDFファイルを閉じる 
    281         $this->pdf->Close(); 
     283        $this->Close(); 
    282284    } 
    283285 
     
    285287    function lfText($x, $y, $text, $size = 0, $style = '') { 
    286288        // 退避 
    287         $bak_font_style = $this->pdf->FontStyle; 
    288         $bak_font_size = $this->pdf->FontSizePt; 
    289  
    290         $this->pdf->SetFont('', $style, $size); 
    291         $this->pdf->Text($x, $y, $this->lfConvSjis($text)); 
     289        $bak_font_style = $this->FontStyle; 
     290        $bak_font_size = $this->FontSizePt; 
     291 
     292        $this->SetFont('', $style, $size); 
     293        $this->Text($x, $y, $this->lfConvSjis($text)); 
    292294 
    293295        // 復元 
    294         $this->pdf->SetFont('', $bak_font_style, $bak_font_size); 
     296        $this->SetFont('', $bak_font_style, $bak_font_size); 
    295297    } 
    296298 
     
    332334    } 
    333335 
     336    /** 
     337     * ゴシックフォントを定義 
     338     * 
     339     * @return void 
     340     */ 
     341    function lfAddGothicFont() { 
     342        $cw = $GLOBALS['SJIS_widths']; 
     343        $c_map = '90msp-RKSJ-H'; 
     344        $registry = array('ordering'=>'Japan1','supplement'=>2); 
     345        $this->AddCIDFonts('Gothic', 'KozGoPro-Medium-Acro,MS-PGothic,Osaka', $cw, $c_map, $registry); 
     346    } 
     347 
     348    /** 
     349     * フッター 
     350     * 
     351     * 現状の PDF_Japanese#Footer の動作によって、生成される PDF がエラーとなるケースがあり、 
     352     * そのエラーを抑える意図。 
     353     * @return void 
     354     */ 
     355    function Footer() { 
     356    } 
    334357} 
    335358?> 
Note: See TracChangeset for help on using the changeset viewer.