Horde_Pdf_Writer::rect PHP Method

rect() public method

It can be drawn (border only), filled (with no border) or both. 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: setLineWidth()
See also: setDrawColor()
See also: setFillColor()
public rect ( float $x, float $y, float $width, float $height, float $style = '' )
$x float Abscissa of upper-left corner.
$y float Ordinate of upper-left corner.
$width float Width.
$height float Height.
$style float Style of rendering. Possible values are: - D or empty string: draw (default) - F: fill - DF or FD: draw and fill
    public function rect($x, $y, $width, $height, $style = '')
    {
        if ($x < 0) {
            $x += $this->w;
        }
        if ($y < 0) {
            $y += $this->h;
        }
        $style = Horde_String::upper($style);
        if ($style == 'F') {
            $op = 'f';
        } elseif ($style == 'FD' || $style == 'DF') {
            $op = 'B';
        } else {
            $op = 'S';
        }
        $x = $this->_toPt($x);
        $y = $this->_toPt($y);
        $width = $this->_toPt($width);
        $height = $this->_toPt($height);
        $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s', $x, $this->hPt - $y, $width, -$height, $op));
    }