src/Html2Pdf.php
protected function setMargins()
    {
        // prepare the margins
        $this->_margeLeft   = $this->_defaultLeft   + (isset($this->_background['left'])   ? $this->_background['left']   : 0);
        $this->_margeRight  = $this->_defaultRight  + (isset($this->_background['right'])  ? $this->_background['right']  : 0);
        $this->_margeTop    = $this->_defaultTop    + (isset($this->_background['top'])    ? $this->_background['top']    : 0);
        $this->_margeBottom = $this->_defaultBottom + (isset($this->_background['bottom']) ? $this->_background['bottom'] : 0);

        // set the PDF margins
        $this->pdf->SetMargins($this->_margeLeft, $this->_margeTop, $this->_margeRight);
        $this->pdf->SetAutoPageBreak(false, $this->_margeBottom);

        // set the float Margins
        $this->_pageMarges = array();
        if ($this->_isInParagraph !== false) {
            $this->_pageMarges[floor($this->_margeTop*100)] = array($this->_isInParagraph[0], $this->pdf->getW()-$this->_isInParagraph[1]);
        } else {
            $this->_pageMarges[floor($this->_margeTop*100)] = array($this->_margeLeft, $this->pdf->getW()-$this->_margeRight);
        }
    }
protected function setMargins()
    {
        // prepare the margins
        $this->_margeLeft   = $this->_defaultLeft   + (isset($this->_background['left'])   ? $this->_background['left']   : 0);
        $this->_margeRight  = $this->_defaultRight  + (isset($this->_background['right'])  ? $this->_background['right']  : 0);
        $this->_margeTop    = $this->_defaultTop    + (isset($this->_background['top'])    ? $this->_background['top']    : 0);
        $this->_margeBottom = $this->_defaultBottom + (isset($this->_background['bottom']) ? $this->_background['bottom'] : 0);

        // set the PDF margins
        $this->pdf->SetMargins($this->_margeLeft, $this->_margeTop, $this->_margeRight);
        $this->pdf->SetAutoPageBreak(false, $this->_margeBottom);

        // set the float Margins
        $this->_pageMarges = array();
        if ($this->_isInParagraph !== false) {
            $this->_pageMarges[floor($this->_margeTop*100)] = array($this->_isInParagraph[0], $this->pdf->getW()-$this->_isInParagraph[1]);
        } else {
            $this->_pageMarges[floor($this->_margeTop*100)] = array($this->_margeLeft, $this->pdf->getW()-$this->_margeRight);
        }
    }
protected function setMargins ( ) { // prepare the margins $ this -> _margeLeft = $ this -> _defaultLeft + ( isset ( $ this -> _background [ 'left' ] ) ? $ this -> _background [ 'left' ] : 0 ) ; $ this -> _margeRight = $ this -> _defaultRight + ( isset ( $ this -> _background [ 'right' ] ) ? $ this -> _background [ 'right' ] : 0 ) ; $ this -> _margeTop = $ this -> _defaultTop + ( isset ( $ this -> _background [ 'top' ] ) ? $ this -> _background [ 'top' ] : 0 ) ; $ this -> _margeBottom = $ this -> _defaultBottom + ( isset ( $ this -> _background [ 'bottom' ] ) ? $ this -> _background [ 'bottom' ] : 0 ) ; // set the PDF margins $ this -> pdf -> SetMargins ( $ this -> _margeLeft , $ this -> _margeTop , $ this -> _margeRight ) ; $ this -> pdf -> SetAutoPageBreak ( false , $ this -> _margeBottom ) ; // set the float Margins $ this -> _pageMarges = array ( ) ; if ( $ this -> _isInParagraph !== false ) { $ this -> _pageMarges [ floor ( $ this -> _margeTop * 100 ) ] = array ( $ this -> _isInParagraph [ 0 ] , $ this -> pdf -> getW ( ) - $ this -> _isInParagraph [ 1 ] ) ; } else { $ this -> _pageMarges [ floor ( $ this -> _margeTop * 100 ) ] = array ( $ this -> _margeLeft , $ this -> pdf -> getW ( ) - $ this -> _margeRight ) ; } }
set the real margin, using the default margins and the page margins
set the real margin using the default margins and the page margins