PhpSigep\Pdf\ImprovedFPDF::CellXp PHP Method

CellXp() public method

public CellXp ( $w, $txt, $align = '', $ln, $h = null, $border, $fill = false, $link = '' )
    public function CellXp($w, $txt, $align = '', $ln = 0, $h = null, $border = 0, $fill = false, $link = '')
    {
        if ($h === null) {
            $h = $this->getLineHeigth();
        }
        $txt = $this->_($txt);
        $this->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
    }

Usage Example

 private function labeledText(ImprovedFPDF $pdf, $label, $text, $maxW, $ln = 0, $multLines = false)
 {
     $pdf->saveState();
     $pdf->SetFont('', '');
     $wLabel = $pdf->GetStringWidthXd($label . '  ');
     $pdf->SetFont('', 'B');
     $xLabel = $pdf->x;
     $pdf->CellXp($wLabel, $label);
     $pdf->SetFont('', '');
     $maxTextW = $maxW - $wLabel;
     if ($multLines) {
         if (is_float($multLines) || is_int($multLines)) {
             $pdf->setLineHeightPadding($multLines);
         }
         $x = $pdf->x - $wLabel;
         $pdf->MultiCellXp($maxTextW, $text);
         if ($ln === 0) {
             $pdf->SetX($x + $maxTextW);
         } else {
             if ($ln == 1) {
                 $pdf->SetX($pdf->lMargin);
             } else {
                 if ($ln == 2) {
                     $pdf->SetX($x);
                 }
             }
         }
     } else {
         while ($text && $maxTextW < $pdf->GetStringWidth($text)) {
             $text = substr($text, 0, strlen($text) - 1);
         }
         $pdf->CellXp($maxTextW, $text, '', $ln);
         if ($ln == 2) {
             $pdf->x -= $wLabel;
         }
     }
     $lastX = $pdf->x;
     $lastY = $pdf->y;
     $pdf->restoreLastState();
     if ($ln === 0) {
         $pdf->SetX($xLabel + $maxW);
     } else {
         if ($ln === 1) {
             $pdf->SetXY($lastX, $lastY);
         } else {
             if ($ln === 2) {
                 $pdf->SetXY($lastX, $lastY);
             }
         }
     }
 }