©
このドキュメントでは、 php中国語ネットマニュアル リリース
Example #1 Fancy "Hello world"
<?php
$doc = new HaruDoc ;
$doc -> setPageMode ( HaruDoc :: PAGE_MODE_USE_THUMBS );
$page = $doc -> addPage ();
$page -> setSize ( HaruPage :: SIZE_A4 , HaruPage :: LANDSCAPE );
$courier = $doc -> getFont ( "Courier-Bold" );
$page -> setRGBStroke ( 0 , 0 , 0 );
$page -> setRGBFill ( 0.7 , 0.8 , 0.9 );
$page -> rectangle ( 150 , 150 , 550 , 250 );
$page -> fillStroke ();
$page -> setDash (array( 3 , 3 ), 0 );
$page -> setFontAndSize ( $courier , 60 );
$page -> setRGBStroke ( 0.5 , 0.5 , 0.1 );
$page -> setRGBFill ( 1 , 1 , 1 );
$page -> setTextRenderingMode ( HaruPage :: FILL_THEN_STROKE );
$page -> beginText ();
$page -> textOut ( 210 , 270 , "Hello World!" );
$page -> endText ();
$doc -> save ( "/tmp/test.pdf" );
?>
Open the result document in your favourite PDF viewer and you should see a light-blue rectangle and white "Hello World!" on it.