CodeIgniter Forums
Problem tcpdf Code Ignited with css - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Problem tcpdf Code Ignited with css (/showthread.php?tid=27599)



Problem tcpdf Code Ignited with css - El Forum - 02-15-2010

[eluser]Unknown[/eluser]
I need help,
how to make pdf from html files on the fly to support css?,
i try tcpdf, but i found problem in css/style
my code like this

(<td style=\"border:#ff0000 solid 1px\">)
cant show/display border...
help me... with your solution to create pdf from html

thanx


&lt;?php

$this->load->plugin( 'tcpdf' );

$pdf = tcpdf();



// set document information

$pdf->SetCreator(PDF_CREATOR);

$pdf->SetAuthor("Nicola Asuni");

$pdf->SetTitle("TCPDF Example 002");

$pdf->SetSubject("TCPDF Tutorial");

$pdf->SetKeywords("TCPDF, PDF, example, test, guide");

// set default header data

$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);



// set header and footer fonts

$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));

$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));



//set margins

$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);



//set auto page breaks

$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);



//set image scale factor

$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);



//initialize document

$pdf->AliasNbPages();



// add a page

$pdf->AddPage();



// ---------------------------------------------------------



// set font

$pdf->SetFont("dejavusans", "BI", 20);



// print a line using Cell()

//$pdf->Cell(0,10,"Example 002",1,1,'C');

$html="<table>

<tr>

<td style=\"border:#ff0000 solid 1px\">

<table border=1>";

for($i=0;$i<30;$i++){

$html.=" <tr>

<td style=\"border:#ff0000 solid 1px\">

".$satu."

</td>

<td>

".$satu."

</td>

</tr>";

}

$html.=" <tr>

<td>

".$dua."

</td>

</tr>

</table>

</td>

</tr>

</table>";

$pdf->writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='');

// ---------------------------------------------------------



//Close and output PDF document

$pdf->Output("example_002.pdf", "I");



?&gt;