function makenewpdf($base){
$GLOBALS['EUC2SJIS'] = true;
$pdf=& new MBfpdi('P','mm','A4');
$pagecount = $pdf->setSourceFile("./base/".$base);
$tplidx = $pdf->ImportPage(1);
$pdf->addPage();
$s = $pdf->useTemplate($tplidx,0,0,241,321);
$pdf->SetY(10);
$pdf->AddMBFont(KOZGO ,'SJIS');
$style="";
$pdf->SetTextColor(255, 255, 255);
$font_size="6";
$pdf->SetFont(KOZGO,$style,$font_size) ;
return $pdf;
}
function set_str($pdf,$x,$y,$myStr){
//$pdf->SetXY($x,$y);
$pdf->Text($x,$y, $myStr);
//$pdf->MultiCell(115, 2, $myStr,0,"J");
return $pdf;
}
function savepdf($pdf,$filename){
$pdf->Output($filename,"F");
}
function put_picture($pdf,$imageFile,$x,$y,$targetW,$targetH){
//print $imageFile;
if($imageFile == "./formatdata/"){return $pdf;}
if($imageFile == "./formatdata_tan/"){return $pdf;}
if($imageFile == "./formatdata_drink/"){return $pdf;}
if(! file_exists($imageFile)){$imageFile = "./formatdata/err.jpg";}
$pdf->Image($imageFile,$x,$y,$targetW,$targetH,'JPEG','');
return $pdf;
}
FPDFの最近のブログ記事
Output
string Output([string name [, string dest]])
name
ファイルの名前
dest
ドキュメントを送信する送信先。 以下のうちのひとつを指定します。
I:ブラウザにインラインにて送信します。存在すればプラグインが利用されます。
D: 指定された名前で強制的にダウンロード。
F: 指定された名前で保存
S: PDFドキュメントを文字列として返します。 name パラメータは無視されます。
Image('file',X,Y,W,H,'fileType','link');
FPDFのインストール
http://www.fpdf.org/
よりFPDFの最新版をダウンロード
http://www.setasign.de/products/pdf-php-solutions/fpdi/downloads/
よりPDFテンプレートを読み込むためのFPDIをダウンロード
http://www.geocities.jp/rui_hirokawa/php/pdf/
からMBFPDF 1.0bをダウンロード(日本語対応)
とパッチファイル(mbfpdfi102.patch.gz)をダウンロード
このパッチは、以下のように適用します。
$ cp fpdf/mbfpdf.php fpdf/MBfpdi.php
$ gzip -cd mbfpdi102.patch.gz | patch -p0
とあるので一旦
FPDFとFPDIとMBFPDFとmbfpdfi102.patch.gzをひとつのフォルダにまとめて
サーバにアップロードしtelnetでサーバにつないで
telnetから実行する。
作成された、MBfpdi.phpをfpdi.phpの代わりに使用する。
http://fpdf.japansite.net/