Horde_Pdf_Writer::setPage PHP Method

setPage() public method

Set the current page
public setPage ( integer $page )
$page integer
    public function setPage($page)
    {
        $this->_page = $page;
    }

Usage Example

Example #1
0
 public function testChangePage()
 {
     $pdf = new Horde_Pdf_Writer(array('format' => array(80, 80), 'unit' => 'pt'));
     $pdf->setInfo('CreationDate', $this->fixtureCreationDate());
     $pdf->setCompression(false);
     $pdf->setMargins(0, 0);
     $pdf->open();
     // first page
     $pdf->addPage();
     $pdf->setFont('Courier', '', 10);
     $pdf->write(10, "Hello");
     // second page
     $pdf->addPage();
     // back to first page again
     $pdf->setPage(1);
     $pdf->write(10, "Goodbye");
     // back to second page
     $pdf->setPage(2);
     $expected = $this->fixture('change_page');
     $this->assertEquals($expected, $pdf->getOutput());
 }