Suneel Kumar Suneel Kumar - 1 year ago 68
CSS Question

how to generate pdf from ckeditor content along with data?

I am trying to generate pdf using TCPDF I have to parse dynamic data in pdf html table working fine.

App::import('Vendor', 'tcpdf');
$tcpdf = new TCPDF();
//$tcpdf->SetHeaderData($header_logo, $header_logo_width, $header_title,
PDF_HEADER_STRING);
$textfont = 'freesans';
$tcpdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$tcpdf->AddPage();
$tcpdf->SetFont('dejavusans', '', 10, '', true);
$test = '
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="height:20px"></td>
</tr>
<tr>
<td style="text-align:center;">Test Report</td>
</tr>
<tr>
<td height="1">&nbsp;</td>
</tr>
</table>
';
$test.="--- Dynamic Data----";

$html = <<<EOF
$test
EOF;
$filename="Test.pdf";
$tcpdf->writeHTML($html, true, false, true, false, '');
$tcpdf->lastPage();
//ob_end_clean();
$tcpdf->Output($filename, 'D');


The above code is working good, But When I parse CKEditor content along with dynamic content it's collapse. I have generate pdf with dynamic data with table format. There is one cell having CKEditor data (any data contents with html) When I was trying to generate pdf the Pdf design was collapse.
Is there any way to generate good format to generate pdf.

Answer Source

try to use MDFP which is a php class who generate pdf et see this video : https://www.youtube.com/watch?v=fPbW7JhIZOQ

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download