2011-01-09 11 views

答えて

3

look http://www.fpdf.de/funktionsreferenz/Cell/ - パラメータ$ alignは、中央揃えのテキストに 'C'を使用します。

機能:そう

$fpdf->Cell(float w, float h, string txt, mixed border, integer ln, string align, integer fill, mixed link); 

$fpdf->Cell(20,10,"Your Content",0,1,"C"); 

現在位置の場所幅= 20を有するセル、高さ= 10と指定されたコンテンツ

+0

のthnxの左から89ミリメートルを中心にテキストを配置します! ...ここにはセルはありません:$ pdf-> SetFont( 'Arial'、 'I'、12); $ pdf-> SetTextColor(0,0,0); $ pdf-> SetXY(80,400); $ pdf-> Write(0、 ""。$ person ["ED"]); – NORM

+0

まあ、それでは、代わりにCellを使うべきです:) – roman

+0

how ......? jeje – NORM

1

この月でそれを埋めお手伝いしますhttp://www.fpdf.de/downloads/addons/41/

$pdf->WriteHTML('You can<P ALIGN="center">center a line</P>'); 
$pdf->MultiCell(75, 8, 'You can<P ALIGN="center">center a line</P>', 'L'); 
+0

fpdfでCSSを使用できますか? –

+0

私は思っていませんでした。 –

0
$fpdf->Cell($fpdf->w,$fpdf->h,"Your Content",0,1,"C"); 
1

getstringwidth関数を使用して、テキストの幅を調整します。 答えを2で割って(中央の位置を取得する)、それを使用して位置をずらします。例えば

pdf.text 89 - (pdf.getstringwidth("Your text here")/2),132,"Your text here" 

対応するためのページ

関連する問題