Hi ppl,
I have a dynamic form, where user can add/remove rows and enter data. This form is basically a invoice. On clicking save button, the data should get saved into db, also a pdf file containing the details of the invoice should be generated.
I came across this
<?
require('html2fpdf.php');
$pdf=new HTML2FPDF();
$pdf->AddPage();
$fp = fopen("sample.html","r");
$strContent = fread($fp, filesize("sample.html"));
fclose($fp);
$pdf->WriteHTML($strContent);
$pdf->Output("sample.pdf");
echo "PDF file is generated successfully!";
?>
sample.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Nations and Flags</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<center><h3>Nations and Flags</h3></center>
<table border="1" width="500" cellspacing="0" cellpadding="2" align="center">
<tr><td>Australia</td><td width="200"><img src="as-t.jpg" width="48" height="32"></td></tr>
<tr><td>Canada</td><td width="200"><img src="ca-t.jpg" width="48" height="32"></td></tr>
<tr><td>China</td><td width="200"><img src="ch-t.jpg" width="48" height="32"></td></tr>
<tr><td>Deutschland - Germany</td><td width="200"><img src="de-t.jpg" width="48" height="32"></td></tr>
<tr><td>France</td><td width="200"><img src="fr-t.jpg" width="48" height="32"></td></tr>
<tr><td>India</td><td width="200"><img src="in-t.jpg" width="48" height="32"></td></tr>
<tr><td>United Kingdom</td><td width="200"><img src="uk-t.jpg" width="48" height="32"></td></tr>
<tr><td>United States of America</td><td width="200"><img src="us-t.jpg" width="48" height="32"></td></tr>
</table>
<body>
</body>
</html>
but here the html page is static, but i have a dynamic page, can anyone guide how to get around with this? or is there any other better method than this. since this is work related i cant use commercial pdflib.
thank you for ur time and suggestion.