if(isset($_POST["create_pdf"]))
{
require_once('tcpdf/tcpdf.php');
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetTitle("Export HTML Table data to PDF using TCPDF in PHP");
$obj_pdf->SetHeaderData('', '', PDF_HEADER_TITLE, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, '5', PDF_MARGIN_RIGHT);
$obj_pdf->setPrintHeader(false);
$obj_pdf->setPrintFooter(false);
$obj_pdf->SetAutoPageBreak(TRUE, 10);
$obj_pdf->SetFont('helvetica', '', 12);
$obj_pdf->AddPage('P', 'A4');
$content = '<style>
body {
background-image: url("Catalog.jpg");
}
</style>';
$content .= '
<table>
<tr>
<th colspan="2"><b>You can also use Bootstraps grid system</b></th>
<th colspan="2"><b>You can also use Bootstraps grid system</b></th>
</tr>
<tr>
<td>You can also use Bootstraps grid system in conjunction with the .thumbnail class to create an image gallery.</td><td><img src="cinqueterre.jpg" alt="Cinque Terre" width="100" height="100" align="left"></td>
<td>You can also use Bootstraps grid system in conjunction with the .thumbnail class to create an image gallery.</td><td><img src="cinqueterre.jpg" alt="Cinque Terre" width="100" height="100" align="left"></td>
</tr>
</table>
';
$obj_pdf->writeHTML($content);
$obj_pdf->Output('sample.pdf', 'I');
}