Pop\Pdf\Pdf::drawClippingRectangle PHP Method

drawClippingRectangle() public method

Method to add a clipping rectangle to the PDF.
public drawClippingRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : Pdf
$x integer
$y integer
$w integer
$h integer
return Pdf
    public function drawClippingRectangle($x, $y, $w, $h = null)
    {
        $oldFillColor = $this->fillColor;
        $oldStrokeColor = $this->strokeColor;
        $oldStrokeWidth = $this->strokeWidth;
        $oldStrokeDashLength = $this->strokeDashLength;
        $oldStrokeDashGap = $this->strokeDashGap;
        $this->setFillColor($this->backgroundColor);
        $this->setStrokeWidth(false);
        $h = null === $h ? $w : $h;
        $co_index = $this->getContentObject();
        $this->objects[$co_index]->setStream("\n{$x} {$y} {$w} {$h} re\nW\nF\n");
        $this->setFillColor($oldFillColor);
        if (null !== $oldStrokeColor) {
            $this->setStrokeColor($oldStrokeColor);
            $this->setStrokeWidth($oldStrokeWidth, $oldStrokeDashLength, $oldStrokeDashGap);
        }
        return $this;
    }