Ignore:
Timestamp:
2011/11/26 16:48:07 (12 years ago)
Author:
Seasoft
Message:

#1566 (帳票PDFを Adobe Reader で開くとエラーが発生する)

File:
1 edited

Legend:

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

    r21316 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(); 
    5757        $this->lfAddGothicFont(); 
    5858 
    5959        // SJISフォント 
    60         $this->pdf->AddSJISFont(); 
    61         $this->pdf->SetFont('SJIS'); 
     60        $this->AddSJISFont(); 
     61        $this->SetFont('SJIS'); 
    6262 
    6363        //ページ総数取得 
    64         $this->pdf->AliasNbPages(); 
     64        $this->AliasNbPages(); 
    6565 
    6666        // マージン設定 
    67         $this->pdf->SetMargins(15, 20); 
     67        $this->SetMargins(15, 20); 
    6868 
    6969        // PDFを読み込んでページ数を取得 
    70         $pageno = $this->pdf->setSourceFile($this->tpl_pdf); 
     70        $pageno = $this->setSourceFile($this->tpl_pdf); 
    7171    } 
    7272 
     
    7575 
    7676        // ページ番号よりIDを取得 
    77         $tplidx = $this->pdf->ImportPage(1); 
     77        $tplidx = $this->ImportPage(1); 
    7878 
    7979        // ページを追加(新規) 
    80         $this->pdf->AddPage(); 
     80        $this->AddPage(); 
    8181 
    8282        //表示倍率(100%) 
    83         $this->pdf->SetDisplayMode($this->tpl_dispmode); 
     83        $this->SetDisplayMode($this->tpl_dispmode); 
    8484 
    8585        if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) { 
     
    8989 
    9090        // テンプレート内容の位置、幅を調整 ※useTemplateに引数を与えなければ100%表示がデフォルト 
    91         $this->pdf->useTemplate($tplidx); 
     91        $this->useTemplate($tplidx); 
    9292 
    9393        $this->setShopData(); 
     
    127127        //ロゴ画像 
    128128        $logo_file = PDF_TEMPLATE_REALDIR . 'logo.png'; 
    129         $this->pdf->Image($logo_file, 124, 46, 40); 
     129        $this->Image($logo_file, 124, 46, 40); 
    130130    } 
    131131 
     
    153153 
    154154        // お届け先情報 
    155         $this->pdf->SetFont('SJIS', '', 10); 
     155        $this->SetFont('SJIS', '', 10); 
    156156        $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 
    157157        $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 
    158158 
    159         $this->pdf->SetFont('Gothic', 'B', 15); 
    160         $this->pdf->Cell(0, 10, $this->lfConvSjis($this->tpl_title), 0, 2, 'C', 0, '');  //文書タイトル(納品書・請求書) 
    161         $this->pdf->Cell(0, 66, '', 0, 2, 'R', 0, ''); 
    162         $this->pdf->Cell(5, 0, '', 0, 0, 'R', 0, ''); 
    163         $this->pdf->SetFont('SJIS', 'B', 15); 
    164         $this->pdf->Cell(67, 8, $this->lfConvSjis(number_format($this->arrDisp['payment_total'])." 円"), 0, 2, 'R', 0, ''); 
    165         $this->pdf->Cell(0, 45, '', 0, 2, '', 0, ''); 
    166  
    167         $this->pdf->SetFont('SJIS', '', 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); 
    168168 
    169169        $monetary_unit = $this->lfConvSjis("円"); 
     
    254254        } 
    255255 
    256         $this->pdf->FancyTable($this->label_cell, $arrOrder, $this->width_cell); 
     256        $this->FancyTable($this->label_cell, $arrOrder, $this->width_cell); 
    257257    } 
    258258 
    259259    function setEtcData() { 
    260         $this->pdf->Cell(0, 10, '', 0, 1, 'C', 0, ''); 
    261         $this->pdf->SetFont('Gothic', 'B', 9); 
    262         $this->pdf->MultiCell(0, 6, $this->lfConvSjis("< 備 考 >"), 'T', 2, 'L', 0, '');  //備考 
    263         $this->pdf->Ln(); 
    264         $this->pdf->SetFont('SJIS', '', 8); 
    265         $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, '');  //備考 
    266266    } 
    267267 
     
    270270        ob_clean(); 
    271271        if ($this->pdf_download == 1) { 
    272             if ($this->pdf->PageNo() == 1) { 
     272            if ($this->PageNo() == 1) { 
    273273                $filename = "nouhinsyo-No".$this->arrData['order_id'].".pdf"; 
    274274            } else { 
    275275                $filename = "nouhinsyo.pdf"; 
    276276            } 
    277             $this->pdf->Output($this->lfConvSjis($filename), 'D'); 
     277            $this->Output($this->lfConvSjis($filename), 'D'); 
    278278        } else { 
    279             $this->pdf->Output(); 
     279            $this->Output(); 
    280280        } 
    281281 
    282282        // 入力してPDFファイルを閉じる 
    283         $this->pdf->Close(); 
     283        $this->Close(); 
    284284    } 
    285285 
     
    287287    function lfText($x, $y, $text, $size = 0, $style = '') { 
    288288        // 退避 
    289         $bak_font_style = $this->pdf->FontStyle; 
    290         $bak_font_size = $this->pdf->FontSizePt; 
    291  
    292         $this->pdf->SetFont('', $style, $size); 
    293         $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)); 
    294294 
    295295        // 復元 
    296         $this->pdf->SetFont('', $bak_font_style, $bak_font_size); 
     296        $this->SetFont('', $bak_font_style, $bak_font_size); 
    297297    } 
    298298 
     
    343343        $c_map = '90msp-RKSJ-H'; 
    344344        $registry = array('ordering'=>'Japan1','supplement'=>2); 
    345         $this->pdf->AddCIDFonts('Gothic', 'KozGoPro-Medium-Acro,MS-PGothic,Osaka', $cw, $c_map, $registry); 
     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() { 
    346356    } 
    347357} 
Note: See TracChangeset for help on using the changeset viewer.