/** * Stroke path * Strokes the path with the current color and line width, and clear it. * * @return bool Returns TRUE on success or FALSE on failure. */ public function stroke() { if (!is_array($this->_last_geometry)) { $this->_errmsg = "No Geometry"; return false; } if (!$this->_page) { $this->_errmsg = "No Page"; return false; } $shape = $this->_last_geometry[0]; switch ($shape) { case 'rect': $this->_page->drawRectangle($this->_last_geometry[1][0], $this->_last_geometry[1][1], $this->_last_geometry[1][0] + $this->_last_geometry[1][2], $this->_last_geometry[1][1] + $this->_last_geometry[1][3], Zend_Pdf_Page::SHAPE_DRAW_STROKE); return true; break; case 'line': $this->_page->drawLine($this->_last_geometry[1][0][0], $this->_last_geometry[1][0][1], $this->_last_geometry[1][1][0], $this->_last_geometry[1][1][1]); return true; break; } $this->_errmsg = "Unknown shape '{$shape}'"; return false; }
/** * Wrapper taking custom units and margins into account * @see \ZendPdf\Page::drawLine() for documentation */ public function drawLine($x1, $y1, $x2, $y2) { $this->convertCoordinatesFromUserSpace($x1, $y1); $this->convertCoordinatesFromUserSpace($x2, $y2); list($y1, $y2) = array($y2, $y1); return parent::drawLine($x1, $y1, $x2, $y2); }