I have a table in HTML-PHP (extract from mySQL). I want to convert it to pdf using fpdf. The convert process is success, but the problem is the position of every single cell is really mess up.
I've tried this code:
$pdf -> SetY(4); // set the cursor at Y position 4
$pdf->Cell(20,50,$body); // draw a cell at pos 4 that has a a width 20 and height 50
But the result is still become like this: Even the header row is mess up.
For an example, you can try it here by searching 42-7278954 as Shipment Code and 965958038-X as Reference No. Then click button export to PDF.
You can see my code for view table (HTML-PHP) in this post.
And here is my code so far:
public function setpdf()
{
require (__DIR__ . '/libraries/html_table.php');
$body = $_POST['body'];
$pdf=new PDF();
$pdf->AddPage('L');
$pdf->SetFont('Arial','',9);
$pdf -> SetY(4); // set the cursor at Y position 4
$pdf->Cell(20,50,$body); // draw a cell at pos 4 that has a a width 20 and height 50
$pdf->WriteHTML($body);
$pdf->Output();
}
Link for viewing code in html_table.php is here