• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • HaruPage::textOut()

    (PECL haru >= 0.0.1)

    Print the text on the specified position

    说明

    HaruPage::textOut(float $x,float $y,string $text): bool

    Prints the text on the specified position.

    参数

    $x
    $y
    $text

    返回值

    Returns TRUE on success.

    错误/异常

    发生错误时抛出HaruException异常。

    参见

    • HaruPage::showTextNextLine() Move the current position to the start of the next line and print the text
    • HaruPage::showText() Print text at the current position of the page
    The text is placed up and to the right of the point given. The point given is the baseline, left of the text.
    The text shows up to the bottom right of the point (x,y).
    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();
    ?>