public function beginTemplate($width = null, $height = null, $groupXObject = false)
    {
        if ($width === null) {
            $width = $this->w;
        }

        if ($height === null) {
            $height = $this->h;
        }

        $templateId = $this->getNextTemplateId();

        // initiate buffer with current state of FPDF
        $buffer = "2 J\n"
            . \sprintf('%.2F w', $this->LineWidth * $this->k) . "\n";

        if ($this->FontFamily) {
            $buffer .= \sprintf("BT /F%d %.2F Tf ET\n", $this->CurrentFont['i'], $this->FontSizePt);
        }

        if ($this->DrawColor !== '0 G') {
            $buffer .= $this->DrawColor . "\n";
        }
        if ($this->FillColor !== '0 g') {
            $buffer .= $this->FillColor . "\n";
        }

        if ($groupXObject && \version_compare('1.4', $this->PDFVersion, '>')) {
            $this->PDFVersion = '1.4';
        }

        $this->templates[$templateId] = [
            'objectNumber' => null,
            'id' => 'TPL' . $templateId,
            'buffer' => $buffer,
            'width' => $width,
            'height' => $height,
            'groupXObject' => $groupXObject,
            'state' => [
                'x' => $this->x,
                'y' => $this->y,
                'AutoPageBreak' => $this->AutoPageBreak,
                'bMargin' => $this->bMargin,
                'tMargin' => $this->tMargin,
                'lMargin' => $this->lMargin,
                'rMargin' => $this->rMargin,
                'h' => $this->h,
                'w' => $this->w,
                'FontFamily' => $this->FontFamily,
                'FontStyle' => $this->FontStyle,
                'FontSizePt' => $this->FontSizePt,
                'FontSize' => $this->FontSize,
                'underline' => $this->underline,
                'TextColor' => $this->TextColor,
                'DrawColor' => $this->DrawColor,
                'FillColor' => $this->FillColor,
                'ColorFlag' => $this->ColorFlag
            ]
        ];

        $this->SetAutoPageBreak(false);
        $this->currentTemplateId = $templateId;

        $this->h = $height;
        $this->w = $width;

        $this->SetXY($this->lMargin, $this->tMargin);
        $this->SetRightMargin($this->w - $width + $this->rMargin);

        return $templateId;
    }
public function beginTemplate($width = null, $height = null, $groupXObject = false)
    {
        if ($width === null) {
            $width = $this->w;
        }

        if ($height === null) {
            $height = $this->h;
        }

        $templateId = $this->getNextTemplateId();

        // initiate buffer with current state of FPDF
        $buffer = "2 J\n"
            . \sprintf('%.2F w', $this->LineWidth * $this->k) . "\n";

        if ($this->FontFamily) {
            $buffer .= \sprintf("BT /F%d %.2F Tf ET\n", $this->CurrentFont['i'], $this->FontSizePt);
        }

        if ($this->DrawColor !== '0 G') {
            $buffer .= $this->DrawColor . "\n";
        }
        if ($this->FillColor !== '0 g') {
            $buffer .= $this->FillColor . "\n";
        }

        if ($groupXObject && \version_compare('1.4', $this->PDFVersion, '>')) {
            $this->PDFVersion = '1.4';
        }

        $this->templates[$templateId] = [
            'objectNumber' => null,
            'id' => 'TPL' . $templateId,
            'buffer' => $buffer,
            'width' => $width,
            'height' => $height,
            'groupXObject' => $groupXObject,
            'state' => [
                'x' => $this->x,
                'y' => $this->y,
                'AutoPageBreak' => $this->AutoPageBreak,
                'bMargin' => $this->bMargin,
                'tMargin' => $this->tMargin,
                'lMargin' => $this->lMargin,
                'rMargin' => $this->rMargin,
                'h' => $this->h,
                'w' => $this->w,
                'FontFamily' => $this->FontFamily,
                'FontStyle' => $this->FontStyle,
                'FontSizePt' => $this->FontSizePt,
                'FontSize' => $this->FontSize,
                'underline' => $this->underline,
                'TextColor' => $this->TextColor,
                'DrawColor' => $this->DrawColor,
                'FillColor' => $this->FillColor,
                'ColorFlag' => $this->ColorFlag
            ]
        ];

        $this->SetAutoPageBreak(false);
        $this->currentTemplateId = $templateId;

        $this->h = $height;
        $this->w = $width;

        $this->SetXY($this->lMargin, $this->tMargin);
        $this->SetRightMargin($this->w - $width + $this->rMargin);

        return $templateId;
    }
public function beginTemplate ( $ width = null , $ height = null , $ groupXObject = false ) { if ( $ width === null ) { $ width = $ this -> w ; } if ( $ height === null ) { $ height = $ this -> h ; } $ templateId = $ this -> getNextTemplateId ( ) ; // initiate buffer with current state of FPDF $ buffer = "2 J\n" . \ sprintf ( '%.2F w' , $ this -> LineWidth * $ this -> k ) . "\n" ; if ( $ this -> FontFamily ) { $ buffer .= \ sprintf ( "BT /F%d %.2F Tf ET\n" , $ this -> CurrentFont [ 'i' ] , $ this -> FontSizePt ) ; } if ( $ this -> DrawColor !== '0 G' ) { $ buffer .= $ this -> DrawColor . "\n" ; } if ( $ this -> FillColor !== '0 g' ) { $ buffer .= $ this -> FillColor . "\n" ; } if ( $ groupXObject && \ version_compare ( '1.4' , $ this -> PDFVersion , '>' ) ) { $ this -> PDFVersion = '1.4' ; } $ this -> templates [ $ templateId ] = [ 'objectNumber' => null , 'id' => 'TPL' . $ templateId , 'buffer' => $ buffer , 'width' => $ width , 'height' => $ height , 'groupXObject' => $ groupXObject , 'state' => [ 'x' => $ this -> x , 'y' => $ this -> y , 'AutoPageBreak' => $ this -> AutoPageBreak , 'bMargin' => $ this -> bMargin , 'tMargin' => $ this -> tMargin , 'lMargin' => $ this -> lMargin , 'rMargin' => $ this -> rMargin , 'h' => $ this -> h , 'w' => $ this -> w , 'FontFamily' => $ this -> FontFamily , 'FontStyle' => $ this -> FontStyle , 'FontSizePt' => $ this -> FontSizePt , 'FontSize' => $ this -> FontSize , 'underline' => $ this -> underline , 'TextColor' => $ this -> TextColor , 'DrawColor' => $ this -> DrawColor , 'FillColor' => $ this -> FillColor , 'ColorFlag' => $ this -> ColorFlag ] ] ; $ this -> SetAutoPageBreak ( false ) ; $ this -> currentTemplateId = $ templateId ; $ this -> h = $ height ; $ this -> w = $ width ; $ this -> SetXY ( $ this -> lMargin , $ this -> tMargin ) ; $ this -> SetRightMargin ( $ this -> w - $ width + $ this -> rMargin ) ; return $ templateId ; }
Begins a new template.

@param float|int|null $width The width of the template. If null, the current page width is used.
@param float|int|null $height The height of the template. If null, the current page height is used.
@param bool $groupXObject Define the form XObject as a group XObject to support transparency (if used).
@return int A template identifier.
Begins a new template .