text() public method

The origin is on the left of the first character, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use {@link cell()}, {@link multiCell()} or {@link write()} which are the standard methods to print text. All coordinates can be negative to provide values from the right or bottom edge of the page (since File_Pdf 0.2.0, Horde 3.2).
See also: setFont()
See also: cell()
See also: multiCell()
See also: write()
public text ( float $x, float $y, string $text )
$x float Abscissa of the origin.
$y float Ordinate of the origin.
$text string String to print.
コード例 #1
0
ファイル: WriterTest.php プロジェクト: jubinpatel/horde
 public function testHelloWorldCompressed()
 {
     $pdf = new Horde_Pdf_Writer(array('orientation' => 'P', 'format' => 'A4'));
     $pdf->setInfo('CreationDate', $this->fixtureCreationDate());
     $pdf->open();
     $pdf->setCompression(false);
     $pdf->addPage();
     $pdf->setFont('Courier', '', 8);
     $pdf->text(100, 100, 'First page');
     $pdf->setFontSize(20);
     $pdf->text(100, 200, 'HELLO WORLD!');
     $pdf->addPage();
     $pdf->setFont('Arial', 'BI', 12);
     $pdf->text(100, 100, 'Second page');
     $actual = $pdf->getOutput();
     $expected = $this->fixture('hello_world_compressed');
     $this->assertEquals($expected, $actual);
 }