function PDFALL($font) { $this->pdfheaderfootfont = $font; parent::MBFPDF(); $this->AddMBFont(GB, 'GB'); $this->AddMBFont(BIG5, 'BIG5'); $this->AddMBFont(GOTHIC, 'SJIS'); }
<?php set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/HelloWorld/application/include/FPDF'); set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/HelloWorld/application/config/'); require_once 'const.php'; require_once 'mbfpdf.php'; //$filepath = $_SERVER['DOCUMENT_ROOT'].'/HelloWorld/temp/TEXT_DATA.txt'; $filepath = 'temp/TEXT_DATA.txt'; $out = file_get_contents($filepath, false); $pdf = new MBFPDF(); $pdf->AddMBFont(GOTHIC, 'SJIS'); $pdf->AddMBFont(PGOTHIC, 'SJIS'); $pdf->Open(); $pdf->AddPage(); $pdf->SetFont(GOTHIC, '', 20); $pdf->Write(10, $out); $pdf->SetFont(PGOTHIC, '', 24); $pdf->Write(10, $out); $pdf->Output();
<?php require 'mbfpdf.php'; // EUC-JP->SJIS 変換を自動的に行なわせる場合に mbfpdf.php 内の $EUC2SJIS を // true に修正するか、このように実行時に true に設定しても変換してくます。 $GLOBALS['EUC2SJIS'] = true; $pdf = new MBFPDF(); $pdf->AddMBFont(GOTHIC, 'SJIS'); $pdf->AddMBFont(PGOTHIC, 'SJIS'); $pdf->AddMBFont(MINCHO, 'SJIS'); $pdf->AddMBFont(PMINCHO, 'SJIS'); $pdf->AddMBFont(KOZMIN, 'SJIS'); $pdf->Open(); $pdf->AddPage(); $pdf->SetFont(GOTHIC, 'U', 20); $pdf->Write(10, "<?={$row->corp_name}?>"); $pdf->SetFont(PGOTHIC, 'U', 20); $pdf->Write(10, "MSPゴシック 摂氏 18 C 湿度 83 %\n"); $pdf->SetFont(MINCHO, 'U', 20); $pdf->Write(10, "MS明朝 摂氏 18 C 湿度 83 %\n"); $pdf->SetFont(PMINCHO, 'U', 20); $pdf->Write(10, "MSP明朝 摂氏 18 C 湿度 83 %\n"); $pdf->SetFont(KOZMIN, 'U', 20); $pdf->Write(10, "小塚明朝 摂氏 18 C 湿度 83 %\n"); $pdf->Output();