Многоэлементное выравнивание FPDF - PullRequest
2 голосов
/ 22 января 2020

У меня проблема с выравниванием мультиклетки с помощью fPDF. 3-й столбец должен быть рядом со 2-м столбцом.

    foreach ($order_items as $item_id => $item) {

        $item_data = $item->get_data();

        $pdf->Cell(35, 5, get_post_meta($item_data['product_id'], 'bdsc_ean_code', true), 1, 0);


        $line_height = 2;
        $width = 60;
        $text = ("fjkbdshjbfbdsjhfbjesfbqwfbjqwefbhwfbhjwebjhfjhqwfbhqwefjbwfhbqwhjfbqwjfjfwqwfbjhefhbq");
        $height = (ceil(($pdf->GetStringWidth($text) / $width)) * $line_height);

        $pdf->Multicell($width,$height,$text,1,0);

        $pdf->Cell(40, 5, '', 1, 0);
        $pdf->Cell(20, 5, $item_data['quantity'], 1, 0);

        $pdf->Cell(34, 5, number_format(round($item_data['total'] + $item_data['subtotal_tax'], 2), 2), 1, 1, 'R');//end of line
    }

Screenshot of the result

1 Ответ

0 голосов
/ 22 января 2020

Может быть, из этого примера вы можете выбрать правильный трек?

$pdf->Cell(40,5,' ','LTR',0,'L',0);   // empty cell with left,top, and right borders
$pdf->Cell(50,5,'Words Here',1,0,'L',0);
$pdf->Cell(50,5,'Words Here',1,0,'L',0);
$pdf->Cell(40,5,'Words Here','LR',1,'C',0);  // cell with left and right borders
$pdf->Cell(50,5,'[ x ] abc',1,0,'L',0);
$pdf->Cell(50,5,'[ x ] checkbox1',1,0,'L',0);
$pdf->Cell(40,5,'','LBR',1,'L',0);   // empty cell with left,bottom, and right borders
$pdf->Cell(50,5,'[ x ] def',1,0,'L',0);
$pdf->Cell(50,5,'[ x ] checkbox2',1,0,'L',0);
...