[eluser]nandish[/eluser]
Hi guys am generating pdf document using dompdf library,the problem is,its not displaying data properly, means if the data contain 40 rows only 30 rows will be displayed in pdf document and the another ten rows will be displayed on the top of pdf document like a garbage text(i think its try to display whole data in a single page,why its not jump to second page) please help me.
Note:Am attaching pdf document please go through and help me
This is my view page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>pdfformat</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style type="text/css">
body {
background-color:white;
font-family:arial;
color:black;
}
td{
padding-left:2px;
padding-right:1px;
}
</style>
</head>
<body>
<form>
<table border='1' cellspacing='0' cellpadding='0' width='580' align='center'>
<tr><td colspan='8' align='center'><h2>Roster Details</h2></td></tr>
<?php
if(count($res)>0){
?>
<tr id="col">
<td align ='center'>Jersey Num</td>
<td align = 'center'>Name</td>
<td align = 'center'>Offensive</td>
<td align = 'center'>Defensive</td>
<td align = 'center'>Grade</td>
<td align = 'center'>Height</th>
<td align = 'center'>Weight</td>
<td align = 'center'>Ltr</td>
</tr>
<?php
foreach ($res as $item){
echo "<tr>";
echo "<td align = 'left' style='padding-left:4px;'>".$item['i_number']."</td>";
echo "<td align = 'left' style='padding-left:5px;' >".$item['s_first_name']." " .$item['s_last_name']."</td>";
echo "<td align = 'center' >";
if($item['s_off_pos'] == "")
echo "-";
else
echo $item['s_off_pos'];
echo "</td>";
echo "<td align = 'center' >";
if($item['s_def_pos'] == "")
echo "-";
else
echo $item['s_def_pos'];
echo "</td>";
echo "<td align = 'center' >";
if($item['s_grade'] == "")
echo "-";
else
echo $item['s_grade'];
echo "</td>";
echo "<td align = 'center' >";
if( $item['s_height'] == "")
echo "-";
else
echo $item['s_height'];
echo "</td>";
echo "<td align = 'center' >";
if($item['s_weight'] == "")
echo "-";
else
echo $item['s_weight'];
echo "</td>";
echo "<td align = 'center' >".$item['i_ltr']."</td>";
echo "</tr>";
}
}
?>
</table>
</form>
</body>
This is my controller
function generatePdf(){
if(!$this->sehelper->checkSession())
return;
$schoolid = $this->sehelper->getUserSchoolID();
$this->load->plugin('to_pdf');
$cu_year=$this->uri->segment(3);
$qteamid=$this->uri->segment(4);
$status=$this->uri->segment(5);
$data['year'] =$cu_year;
$data['teamid'] = $qteamid;
$data['status'] = $status;
$data['res'] = $this->MRoster->selectAll($qteamid,$status,$cu_year);
$html=$this->load->view('vrpdf',$data,true);
pdf_create($html,'Roster_'.$schoolid,true);
}
this is my plugin file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function pdf_create($html, $path, $filename,$stream = TRUE) {
require_once("dompdf/dompdf_config.inc.php");
ini_set("memory_limit","32M");
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdf=$dompdf->output();
if($stream){
$dompdf->stream($filename.".pdf");}
}
?>
I can able to generate pdf document but only the problem is, the data will not display properly.its try to display whole data in one page why its not displaying data in second page...please help me
Thanks guys...