/** * Parse and draw table on the page. * * @return array List of pages with table. */ public function render() { $y = $this->page->getHeight() - $this->y; foreach ($this->_rows as $row) { if ($y - $row->testRender($this->page, $this->x, $y) < 0) { $font = $this->page->getFont(); $fontSize = $this->page->getFontSize(); $this->page = new Phprojekt_Pdf_Page($this->page); $this->page->setFont($font, $fontSize); $this->_pages[] = $this->page; $y = $this->page->getHeight() - $this->page->borderTop; } $row->render($this->page, $this->x, $y); $y -= $row->getHeight(); } $positionOfTheLastRow = $this->page->getHeight() - $y; $rowHeight = $this->page->getFontSize() * $this->page->lineHeight; $this->page->freeLineY = $positionOfTheLastRow + $rowHeight; return $this->_pages; }
/** * Test function. * * @param Phprojekt_Pdf_Page $page Current page. * @param integer $x Start position x. * @param integer $y Start position y. * * @return void */ public function testRender($page, $x, $y) { $fontSize = $page->getFontSize(); $size = $page->getVariableText($this->_text, $x, $page->getHeight() - $y + $fontSize, $this->_width, $this->_encoding); $this->_height = $size['height'] + $page->tablePadding; $this->_width = $this->_width; }