Placing two MultiCells next to each other using FPDF in PHP

前端 未结 3 1067
陌清茗
陌清茗 2021-01-18 12:19

I trying to create a custom table using FPDF Cell/MultiCell.

My 1st cell is a MultiCell that has two lines of text. The next cell should then just be pl

相关标签:
3条回答
  • 2021-01-18 12:58

    I found the solution - fpdf has an extension (#3) focussed on using multicells.

    0 讨论(0)
  • 2021-01-18 12:59

    this worked for me

    $pdf->multicell(120, 5, '   ' . $actividad, 0, 'l', true);
    $x = $pdf->GetX();
    $y = $pdf->GetY();
    $pdf->SetXY($x + 120, $y);
    $pdf->Cell(70, -5, '   ' . $claseActividad, '', 0, 'l', true);
    

    result

    0 讨论(0)
  • 2021-01-18 13:06

    Before printing your first multicell, record the cursor position:

    $x=$this->GetX();
    $y=$this->GetY();
    

    add your multicell using $this->Multicell($w,5,'Content');

    Reset the cursor position to the start height (y) and the start horizontal + the width of the 1st multicell:

    $this->SetXY($x+$w,$y);
    

    Add your next multicell and repeat as necessary.

    0 讨论(0)
提交回复
热议问题