<?php

$doc 
= new HaruDoc

$doc->setPageMode(HaruDoc::PAGE_MODE_USE_THUMBS); /* show thumbnails */

$page $doc->addPage(); /* add page to the document */
$page->setSize(HaruPage::SIZE_A4HaruPage::LANDSCAPE); /* set the page to use A4 landscape format */

$courier $doc->getFont("Courier-Bold"); /* we'll use the bundled font a few lines below */

/* [the rectangle] */
$page->setRGBStroke(000); /* set colors */
$page->setRGBFill(0.70.80.9);
$page->rectangle(150150550250); /* draw a rectangle */
$page->fillStroke(); /* fill and stroke it */
/* [/the rectangle] */

$page->setFontAndSize($courier60); /* set font and size */
$page->setRGBFill(111); /* set filling color */

$page->beginText();

$text "Hello";
$angle1 90 strlen($text);;
$angle2 130;

for (
$i 0$i strlen($text); $i++) {
    
$rad1 = ($angle2 90) / 180 3.141592;
    
$rad2 $angle2 180 3.141592;
    
$x 420 cos($rad2) * 300;
    
$y 50 sin($rad2) * 300;

    
$page->setTextMatrix(cos($rad1), sin($rad1), -sin($rad1), cos($rad1), $x$y);

    
$page->showText($text[$i]);
    
$angle2 -= $angle1;
}

$text "World!";
$angle1 90 strlen($text);;
$angle2 = -140;

for (
$i 0$i strlen($text); $i++) {
    
$rad1 = ($angle2 90) / 180 3.141592;
    
$rad2 $angle2 180 3.141592;
    
$x 420 sin($rad2) * 300;
    
$y 470 cos($rad2) * 300;

    
$page->setTextMatrix(sin($rad1), cos($rad1), -cos($rad1), sin($rad1), $x$y);

    
$page->showText($text[$i]);
    
$angle2 -= $angle1;
}
$page->endText();

$doc->save("/tmp/test.pdf"); /* save the document into a file */

?>