php教程

HaruPage::showText

(PECL haru >= 0.0.1)

HaruPage::showTextPrint text at the current position of the page

说明

HaruPage::showText ( string $text ) : bool

Prints out the text at the current position of the page.

参数

text

The text to show.

返回值

Returns TRUE on success.

错误/异常

发生错误时抛出 HaruException 异常。

参见

User Contributed Notes

aku at syuaa dot net 09-Jun-2011 03:02
My First Hello Text

<?php

$text
= "Hello Text";

$doc=new HaruDoc;
$page=$doc->addPage();

//load haru font Times-Roman
$font = $doc->getFont('Times-Roman');

//Set margin top to 50 pixel
$mTop = 50;

//Set first yPos, you will need to reduce text height
$ypos = $page->getHeight()-$mTop-12;

$page->beginText();
$page->setFontandSize($font, 12);
$page->moveTextPos(100,$ypos,false);
$page->showText($text);
$page->endText();

header('Content-type: application/pdf');
$doc->output();

/*[x]syuaa[x]*/
?>

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788