I am using mPDF
to download the HTML form. There is one button and on clicking on that it download the form.
PHP function to download PDF:
function download($id)
{
$data = $this->test_model->getMoreDataByID($id);
$name = str_replace(' ', "-", strtolower($data['name']));
$time = time();
$file_name = $name.$time.$id;
$html=$this->load->view('folder/form_download', $data, true);
$pdfFilePath = $file_name.".pdf";
$this->load->library('m_pdf');
$this->m_pdf->pdf->SetDisplayMode('fullpage');
$this->m_pdf->pdf->WriteHTML($html);
$this->m_pdf->pdf->Output($pdfFilePath, "D");
}
Here is the PDF data to be generate:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Annex C</title>
<style>
body {
font-family: "futura_md_btmedium";
}
.info_head{
font-size:20px;
font-weight:bold;
}
.invoice-box{
max-width:800px;
margin:auto;
border:2px solid #000;
font-size:16px;
color:#555;
}
.invoice-box table{
width:100%;
line-height:inherit;
}
.mtopm54 {
margin-top: -54px;
}
.mtopm47 {
margin-top: -47px;
}
.t-align {
text-align: center;
}
.invoice-box table td{
padding:5px;
vertical-align:top;
}
.invoice-box table tr.details td {
padding-bottom: 10px;
border: 0.5px dotted #ddd;
}
.invoice-box table tr.top table td.title{
font-size:11px;
color:#333;
text-align: center;
}
.invoice-box table tr.information table td{
padding-bottom:40px;
}
.invoice-box table tr.heading td{
background:#0776b8;
font-weight:bold;
text-align:center;
color:#fff;
}
.invoice-box table tr.details td{
text-align:center;
}
.total_details td{
border-top:1px solid #ddd;
font-weight:bold;
}
.invoice-box table tr.item.last td{
border-bottom:none;
}
@media only screen and (max-width: 600px) {
.invoice-box table tr.top table td{
width:100%;
display:block;
text-align:center;
}
.invoice-box table tr.information table td{
width:100%;
display:block;
text-align:center;
}
}
.separator td{
padding-bottom:40px !important;
}
.bold-font {
font-weight: bold;
}
.bottom-border {
border-bottom: 1px solid #000;
}
.pbottopm-border {
padding-bottom: 4px;
border-bottom: 1px dotted #000;
}
.remark {
border-bottom: 1px solid #000;
padding-bottom: 2px;
}
</style>
</head>
<body>
<div class="invoice-box">
<table cellpadding="0" cellspacing="0">
<table class="t-align mtopm54 bottom-border">
<tr class="top">
<td colspan="4">
<tr>
<td class="title">
<b class="bold-font">This portion is to be completed where the solicitor is acting for the Corporation. <br>
SEARCHES ON THE RELEVANT PARTY <br>
</b> ("Relevant Party" as defined in the instruction on Legal Requisitions and Searches (Annex C))
</td>
</tr>
</td>
</tr>
</table>
<table class="mtopm54">
<tr>
<td style="width:16%">
<strong>Corporation Name:</strong>
</td>
<td style="width:70%">
<span class="pbottopm-border"><?= $corp_name; ?></span>
</td>
</tr>
</table>
<table class="mtopm54 bottom-border">
<tr>
<td style="width:16%">
<b>Accounting Corporate and Regulatory Authority ("ACRA") search (copy to be enclosed)</b>
</td>
</tr>
</table>
<table class="mtopm54">
<tr>
<td>
1) Does the ACRA search disclose any charge or debenture against the company?
</td>
</tr>
</table>
<table class="mtopm47">
<tr>
<td style="width:16%">
<input type="checkbox" <?php echo ($q_one=='No' ? 'checked' : '');?> name="q_one" class="" value="No" id="q_one"><span class="mleft5">No</span>
<input type="checkbox" <?php echo ($q_one=='Yes' ? 'checked' : '');?> name="q_one" class="" value="Yes" id="q_one"><span class="mleft5">Yes</span>
</td>
<td>
<span>If yes, please provide details (including relevant copies) of the charge or debenture or any other encumbrances against the company immediately.</span>
</td>
</tr>
</table>
</table>
</div>
</body>
</html>
It is generating PDF like this: PDF-Generated
It is generating the HTML: HTML
But some how it is not generating that data into PDF file. Any reason?