©
本文檔使用 php中文網手册 發布
(PECL haru >= 0.0.1)
HaruPage::textOut — Print the text on the specified position
$x
, float $y
, string $text
)Prints the text on the specified position.
x
y
text
Returns TRUE
on success.
发生错误时抛出 HaruException 异常。
[#1] aku at syuaa dot net [2011-06-09 02:53:56]
a simple sample of textOut :
<?php
$text = "Syuaa is another little programmer";
$doc=new HaruDoc;
$page=$doc->addPage();
//load haru font Times-Roman
$font = $doc->getFont('Times-Roman');
//Begin creating text on x100, y150
$page->beginText();
$page->setFontandSize($font, 12);
$page->textOut(100, 150, $text);
$page->endText();
//Open as pdf
header('Content-type: application/pdf');
$doc->output();
?>