Damara Jati P
Damara Jati P

Reputation: 1807

FPDF weirdly error put image in CELL

i have no idea about this, why the image is out of the line

here's the result

enter image description here

here's my codes

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->cell(10,30,'',0,0,'');
        $fpdf->Cell(65,30,$fpdf->Image('assets/images/qrcodes/qrcodse.png', $fpdf->GetX(), $fpdf->GetY(), 30),1,0,'',false);
            $fpdf->Ln(33);

it's only looping the same CELL function

Thanks!!!

Upvotes: 0

Views: 1012

Answers (1)

Jan Slabon
Jan Slabon

Reputation: 5058

The Cell() method expects a string as its third parameter. While the Image() method does not return anything.

That writing: You cannot place an image into a cell this way. It does not do what you expect.

Just move the Image() calls before each Cell() call and you will see no difference.

The page break you see is triggered because the later Cell() call is triggering it. You may disable it or set another bottom margin value through the SetAutoPageBreak() method:

$fpdf->SetAutoPageBreak(false);
// or
$fpdf->SetAutoPageBreak(true, 0);

If you disable it, you will need to add the pages yourself.

Upvotes: 2

Related Questions