- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_11-dev/data/class/SC_Fpdf.php
r21024 r21358 32 32 define('PDF_TEMPLATE_REALDIR', TEMPLATE_ADMIN_REALDIR . 'pdf/'); 33 33 34 class SC_Fpdf {34 class SC_Fpdf extends PDF_Japanese { 35 35 function SC_Fpdf($download, $title, $tpl_pdf = 'nouhinsyo1.pdf') { 36 $this->FPDF(); 36 37 // デフォルトの設定 37 38 $this->tpl_pdf = PDF_TEMPLATE_REALDIR . $tpl_pdf; // テンプレートファイル … … 54 55 ); 55 56 56 $this-> pdf = new PDF_Japanese();57 $this->lfAddGothicFont(); 57 58 58 59 // SJISフォント 59 $this-> pdf->AddSJISFont();60 $this-> pdf->SetFont('SJIS');60 $this->AddSJISFont(); 61 $this->SetFont('SJIS'); 61 62 62 63 //ページ総数取得 63 $this-> pdf->AliasNbPages();64 $this->AliasNbPages(); 64 65 65 66 // マージン設定 66 $this-> pdf->SetMargins(15, 20);67 $this->SetMargins(15, 20); 67 68 68 69 // PDFを読み込んでページ数を取得 69 $pageno = $this-> pdf->setSourceFile($this->tpl_pdf);70 $pageno = $this->setSourceFile($this->tpl_pdf); 70 71 } 71 72 … … 74 75 75 76 // ページ番号よりIDを取得 76 $tplidx = $this-> pdf->ImportPage(1);77 $tplidx = $this->ImportPage(1); 77 78 78 79 // ページを追加(新規) 79 $this-> pdf->AddPage();80 $this->AddPage(); 80 81 81 82 //表示倍率(100%) 82 $this-> pdf->SetDisplayMode($this->tpl_dispmode);83 $this->SetDisplayMode($this->tpl_dispmode); 83 84 84 85 if (SC_Utils_Ex::sfIsInt($arrData['order_id'])) { … … 88 89 89 90 // テンプレート内容の位置、幅を調整 ※useTemplateに引数を与えなければ100%表示がデフォルト 90 $this-> pdf->useTemplate($tplidx);91 $this->useTemplate($tplidx); 91 92 92 93 $this->setShopData(); … … 126 127 //ロゴ画像 127 128 $logo_file = PDF_TEMPLATE_REALDIR . 'logo.png'; 128 $this-> pdf->Image($logo_file, 124, 46, 40);129 $this->Image($logo_file, 124, 46, 40); 129 130 } 130 131 … … 152 153 153 154 // お届け先情報 154 $this-> pdf->SetFontSize(10);155 $this->SetFont('SJIS', '', 10); 155 156 $this->lfText(25, 125, SC_Utils_Ex::sfDispDBDate($this->arrDisp['create_date']), 10); //ご注文日 156 157 $this->lfText(25, 135, $this->arrDisp['order_id'], 10); //注文番号 157 158 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); 166 168 167 169 $monetary_unit = $this->lfConvSjis("円"); … … 252 254 } 253 255 254 $this-> pdf->FancyTable($this->label_cell, $arrOrder, $this->width_cell);256 $this->FancyTable($this->label_cell, $arrOrder, $this->width_cell); 255 257 } 256 258 257 259 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, ''); //備考 264 266 } 265 267 … … 268 270 ob_clean(); 269 271 if ($this->pdf_download == 1) { 270 if ($this-> pdf->PageNo() == 1) {272 if ($this->PageNo() == 1) { 271 273 $filename = "nouhinsyo-No".$this->arrData['order_id'].".pdf"; 272 274 } else { 273 275 $filename = "nouhinsyo.pdf"; 274 276 } 275 $this-> pdf->Output($this->lfConvSjis($filename), 'D');277 $this->Output($this->lfConvSjis($filename), 'D'); 276 278 } else { 277 $this-> pdf->Output();279 $this->Output(); 278 280 } 279 281 280 282 // 入力してPDFファイルを閉じる 281 $this-> pdf->Close();283 $this->Close(); 282 284 } 283 285 … … 285 287 function lfText($x, $y, $text, $size = 0, $style = '') { 286 288 // 退避 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)); 292 294 293 295 // 復元 294 $this-> pdf->SetFont('', $bak_font_style, $bak_font_size);296 $this->SetFont('', $bak_font_style, $bak_font_size); 295 297 } 296 298 … … 332 334 } 333 335 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 } 334 357 } 335 358 ?>
Note: See TracChangeset
for help on using the changeset viewer.