I am new to fpdf cell and multicell and need help with my code. Below is the code I wrote:
$pdf->Cell(60, 6, 'MAILING ADDRESS', 'L,R', 0); $pdf->Multicell(65, 5, $puchaser1[0]["address"], 1); $pdf->Cell(60, 11, $puchaser2[0]["address"], 1); $pdf->Cell(60, 8, 'PHONE NUMBER', 1, 0); $pdf->Cell(65, 8, $puchaser1[0]["contact_no"], 1, 0); $pdf->Cell(65, 8, $puchaser2[0]["contact_no"], 1, 1);
I want it to look like this:
P粉7528260082023-09-10 13:45:29
I strongly recommend using more variables. Your code might look like this:
// Height is different in multicell, this stands for lineheight and should be the same as other cells :) // I would advise you to go for, SMALL_CELL and BIG_CELL if you want to differentiate $WIDTH_CELL = 60; $HEIGHT_CELL = 5; // Most of the time, you want to border all so let's put this in a variable as well // Not in your case though, but more on that below this :) $BORDER = 1; $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, 'MAILING ADDRESS', $border, 0); $pdf->Multicell($WIDTH_CELL, $HEIGHT_CELL, $puchaser1[0]["address"], $border); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser2[0]["address"], $border); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, 'PHONE NUMBER', 1, 0); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser1[0]["contact_no"], $border, 0); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser2[0]["contact_no"], $border, 1);
However, this cannot solve your problem. You're going to have a bad time because you need:
All other borders should be specifically "L", "R", or "LR". You have to draw the top border, bottom (sometimes L or R) border with a rectangle.
There is a lot of code, so if you have such code, I will help you further :)