Suppose that I have the PHP code as below:
<html>
<head>
<title>Convert HTML to PDF</title>
</head>
<body>
<form name="frm" method=post>
<div class="HoldPage">
<div class="page">
<h1 style="text-align:center; font-size:18px;">COMPORTEMENT/COMPETENCES</h1>
<p style="text-align:center;">Déterminer et évaluer les seuls critères nécessaires à la tenue du poste</p>
<p class="text_P">COMPETENCES OPERATIONNELLES</p>
<hr class='dashes'>
<ul type="disc">
<li><strong>CONNAISSANCE ET EXPERIENCE (O/E/AM/Cadres)</strong></li>
</ul>
<input type="submit" name="convert2PDF" value="GeneratePDF">
<?php
if(isset($_POST['convert2PDF'])){
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=html2pdf.pdf");
}
?>
</form>
</body>
</html>
I need:
When I click on button submit it will generate HTML to PDF file.
Problem:
Actually, It not works.How do I fix this.Does it have any method that easier than this?Anyone help me please.Thanks,
Use tcPDF or dompdf type plugin/extension with cakePHP
review the below link
http://bakery.cakephp.org/articles/kalileo/2010/06/08/creating-pdf-files-with-cakephp-and-tcpdf
http://www.juliaholland.org/2009/01/23/cakephp-and-tcpdf